Hi All

I have a data frame in which on the columns is a factor with following
levels

Levels: M006 M0114 M0379 M0432 M0823 M1012 M1096 M1107 SW393 SW708

I want to change all the M006 to "1", M0114 to "2" and so on.  What I am
trying is not working.

data1$sample[data1$sample =='M006'] <- "1"
Warning message:
In `[<-.factor`(`*tmp*`, data1$sample == "M006", value = "1") :
  invalid factor level, NAs generated


Any slick way to do this ?

Thanks!
-Abhi

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to