This can't be reproduced without data -- kindly supply the result of test_1 right after the first line using dput() if you would.
Michael On Mon, Nov 21, 2011 at 10:42 AM, set <asta...@hotmail.com> wrote: > Hello R users, > > I'm trying to replace numerical values in a datamatrix with strings. R does > this except for numbers under 10000 starting with a 9 (eg 98, 970, 9504 > etc). This is really weird and I wondered whether someone had encountered > such a problem or knows the solution. I'm using the next script: > > test_1 <- read.table("5+ref_151111clusters3.csv", header = TRUE, sep = ",", > colClasses = "numeric") > test_1[test_1 > 94885 & test_1 <= 113835] = "KE3926OT" > test_1[test_1 != 0 & test_1 <= 18954] = "I8456" > test_1[test_1 > 75944 & test_1 <= 94885] = "KE3873" > test_1[test_1 > 56951 & test_1 <= 75944] = "KE3870" > test_1[test_1 > 37991 & test_1 <= 56951] = "Cyprus1" > test_1[test_1 > 18954 & test_1 <= 37991] = "ref" > write.table(test_1, file = "test_replace7.txt", quote = FALSE, sep="\t") > > Thanks, > Set > > -- > View this message in context: > http://r.789695.n4.nabble.com/R-ignores-number-only-with-a-nine-under-10000-tp4091936p4091936.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.