[R] R drop behavior -- set as option in later version?

Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si
Fri Sep 8 13:33:05 CEST 2006


Balaji S. Srinivasan <balajis <at> stanford.edu> writes:
> ...
Hello,

I agree with you that you find yourself typing the same constructs over and
over. I think that we need to distinguish two modes of working with R. If you do
analysis, then you can really get tired of typing drop=FALSE, na.rm=TRUE etc.
But this things are very important when you are programming in R. Since these
two modes are not really separated in R I do not think this is an easy task, but
it would be great to have it. I had recently the same question for na.rm=TRUE.
But imagine how hard would it be to have two separate modes ... argh, probably a
mess^2 or have I missed something obvious.

> The possible caveats are:
> 
> 1) Performance issues associated with GetOption call (this is probably
> not a showstopper)
> 2) Breaking old code which assumes drop=TRUE if the drop=FALSE option is set.
> 
> For the latter situation, it would be possible to wrap any new code
> with an options setting as follows:
> 
> og <- options("GlobalDrop")
> options(GlobalDrop=FALSE)
> #new code here which assumes drop=FALSE
> options(og)

I think that local options i.e. drop=TRUE in code should override global ones.

Gregor



More information about the R-help mailing list