syrvn wrote:
Thanks again for your quick reply. I understood your procedure but now it is even more strange why my conversion does not work. In your example, the NA values are in "brackets" <NA> and what your procedure does is to convert these <NA> values into NA and then it seems to be possible to use data.matrix to correctly convert the data.frame into a data.matrix. But the data I read into R are already in that form that the NA values are displayed as NA rather than <NA>. So the conversion should actually work.
Have not followed this thread, but I think you're confused about what a true NA value is, at least with factors. When values of a factor are missing, they are printed <NA> to distinguish them from an actual factor level of NA. Numeric missings are printed NA.
> f1 <- factor("NA") > f1 [1] NA Levels: NA > is.na(f1) [1] FALSE vs. > n1 <- c(NA) > n1 [1] NA > is.na(n1) [1] TRUE ______________________________________________ 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.