[R] set values in data.frame to NA conditional on another data.frame

Carson Farmer cfarmer at uvic.ca
Wed Jul 2 23:17:44 CEST 2008


Hello List,

Is there a faster way to set values in one data.frame equal to NA 
conditional on the corresponding value in another data.frame? Currently 
I am using:
 > b[is.na(a)] <- NA
where 'a' and 'b' are data.frames of equal size/dimensions, and 'a' 
contains NAs but 'b' does not. This is extremely slow as is, as my 
data.frames are about 6000 columns by 6000 rows in size.
Are there any tricks to speed things up here?

Thank you in advance,

Carson



More information about the R-help mailing list