From: Berton Gunter <gunter.berton_at_gene.com>

Date: Wed 03 May 2006 - 03:48:49 EST

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 Received on Wed May 03 03:58:18 2006

Date: Wed 03 May 2006 - 03:48:49 EST

Below.

> -----Original Message-----

*> From: Gabor Grothendieck [mailto:ggrothendieck@gmail.com]
**> 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 <gunter.berton@gene.com> 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 Received on Wed May 03 03:58:18 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Wed 03 May 2006 - 06:09:59 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*