--- Berton Gunter <[EMAIL PROTECTED]> wrote: > Below.
My "what does it mean" was meant as a joke! However your responses + Gabor's have really helped. I don't really have the knowledge to understand everything but I think I am getting a better feel for what is happening which should translate to other parts of R as well. I have also found that I can use something on faith for a few days and then I suddenly have enough context to understand what it is doing. Thanks again. > > > -----Original Message----- > > From: Gabor Grothendieck > [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, May 02, 2006 10:42 AM > > To: Berton Gunter > > Cc: John Kane; R R-help > > Subject: Re: [R] Adding elements in an array where > I have > > missing data. > > > > On 5/2/06, Berton Gunter <[EMAIL PROTECTED]> > wrote: > > > > > > > > Here are a few alternatives: > > > > > > > > replace(a, is.na(a), 0) + b > > > > > > > > ifelse(is.na(a), 0, a) + b > > > > > > > > mapply(sum, a, b, MoreArgs = list(na.rm = > TRUE)) > > > > > > > > > > Well, Gabor, if you want to get fancy... > > > > > > evalq({a[is.na(a)]<-0;a})+b > > > > > > > Note that the evalq can be omitted: > > > > { a[is.na] <- 0; a } + b > > > > No it can't. The idea is **not** to change the > original a. > > -- Bert > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html