[R] Replacing NA values in one column of a data.frame

Steve Murray smurray444 at hotmail.com
Mon Aug 17 17:41:59 CEST 2009

Dear all,

I'm trying to replace NA values with -9999 in one column of a data frame. I've tried using is.na and the testdata[testdata$onecolumn==NA] <- 9999 approach, but whilst neither generate errors, neither result in -9999s appearing - the NAs remain there!

I'd be grateful for any advice on what I'm doing wrong or any other suitable approaches.

Many thanks,




More information about the R-help mailing list