Re: [R] Global setting for na.rm=TRUE

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue 01 Aug 2006 - 23:38:54 EST

There is a global option setting for na.action. See ?na.action . That does not completely address your question but might help with lm, glm, etc.

You could define your own wrapper functions if you know ahead of time which functions with na.rm= args you need. e.g.

my.max = function(..., na.rm = getOption("na.rm")) max(..., na.rm = na.rm) getOption("na.rm") # NULL
my.max(1, 2, NA) # 2
options(na.rm = FALSE)
my.max(1,2,NA) # NA

On 8/1/06, Gorjanc Gregor <Gregor.Gorjanc@bfro.uni-lj.si> wrote:
> Hello!
>
> Is it possible to set na.rm=TRUE in a global way? I'am constantly
> forgeting on this when performing analyses. I agree that one should
> be carefull with this when developing some code, but not necesarilly
> so in data analysis.
>
> Lep pozdrav / With regards,
> Gregor Gorjanc
>
> ----------------------------------------------------------------------
> University of Ljubljana PhD student
> Biotechnical Faculty URI: http://www.bfro.uni-lj.si/MR/ggorjan
> Zootechnical Department mail: gregor.gorjanc <at> bfro.uni-lj.si
> Groblje 3 tel: +386 (0)1 72 17 861
> SI-1230 Domzale fax: +386 (0)1 72 17 888
> Slovenia, Europe
> ----------------------------------------------------------------------
> "One must learn by doing the thing; for though you think you know it,
> you have no certainty until you try." Sophocles ~ 450 B.C.
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>



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 and provide commented, minimal, self-contained, reproducible code. Received on Wed Aug 02 01:05:15 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 02 Aug 2006 - 02:17:41 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.