[R] Replacing NA values in one column of a data.frame
jholtman at gmail.com
Tue Aug 18 13:27:04 CEST 2009
testdata[is.na(testdata$onecolumn)] <- -9999
On Mon, Aug 17, 2009 at 11:41 AM, Steve Murray<smurray444 at hotmail.com> wrote:
> 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,
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help