On Sep 26, 2012, at 12:52 PM, JiangZhengyu wrote: > > > > > Hi everyone, I have a data frame Gene with SNPs eg. P1 P2 P3 > CG CG GG > -- -- AC > -- AC CC > AC -- AC I tried to replace all the GG with a value 3. > Gene[Gene=="GG"]<-3 It always give me: Warning in `[<-.factor`(`*tmp*`, > thisvar, value = 3) : > invalid factor level, NAs generated Does any know if there is anything wrong > with my code?
You are trying to replace a factor value with a level that it doesn't have. Hence that particular very informative error message. -- David Winsemius, MD Alameda, CA, USA ______________________________________________ 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.