Try bb[is.na(aa)] <- NA It may be simple but it is not necessarily obvious :) --- Carson Farmer <[EMAIL PROTECTED]> wrote:
> Dear List, > > I am looking for an efficient method for replacing > values in a > data.frame conditional on the values of a separate > data.frame. Here is > my scenario: > I have a data.frame (A) with say 1000 columns, and > 365 rows. Each cell > in the data.frame has either valid value, or NA. I > have an additional > data.frame (B) with the same number of rows and > columns, with valid > values in all cells. What I would like to do, is > replace the cells in B > with NA if and only if the corresponding cell in A > is NA. > I have search extensively for a method to do this, > and I'm sure that in > the end the solution will be embarrassingly simple, > however, any help is > greatly appreciated! > > Cheers, > > Carson > > Apologies if this has been posted twice, we are > currently experiencing > server problems... > > ______________________________________________ > 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. > ______________________________________________ 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.