[R] Replace individual values in a data frame with NA

Jason Horn jhorn at bu.edu
Fri Feb 9 17:10:15 CET 2007


I'd like to replace a value in a data frame with an NA, but can't  
figure out how.

For example, say you have

a<-c(1,2,3,4)
b<-c(5,6,7,8)
data<-data.frame(a,b)

Now, how would you set the third row of the second column ( data 
[[3,2]] ) to NA?

I have tried all types of permutations with is.na, including is.na<- 
data[[3,2]], which does not work.

Thanks



More information about the R-help mailing list