On Wed, 11 Nov 2009, Peng Yu wrote:

On Mon, Oct 19, 2009 at 7:57 PM, Peng Yu <pengyu...@gmail.com> wrote:
tmp <- matrix(1:2)
tmp
tmp[,1,drop=FALSE]


See the above example. Is there a way to make 'drop=FALSE' as global
default, so that when I say 'tmp[,1]', R will treat it as
'tmp[,1,drop=FALSE]'?

Is there a way to set drop=FALSE globally?

No.

I can't remember to put
drop=FALSE to all the '[]'s. But this indeed causes some weird bugs
for me to figure out.

It would probably cause a lot more weird bugs if the behavior of [ depended on 
a global option.

         -thomas

Thomas Lumley                   Assoc. Professor, Biostatistics
tlum...@u.washington.edu        University of Washington, Seattle

______________________________________________
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.

Reply via email to