Skip to content
Prev 70079 / 398506 Next

R annoyances


        
TL> On Thu, 19 May 2005, Rod Montgomery wrote:
>> Thomas Lumley wrote:
>>> This one is actually a FAQ, mtx[,1,drop=FALSE]
    >>> 
    >>> -thomas
    >>> 
    >> I wonder whether there is, or should be, a way to set
    >> FALSE as the default?

    TL> There shouldn't be (apart from editing the code),
    TL> because you really don't want something this basic to be
    TL> unpredictable.

    TL> There have been discussions at several times about
    TL> whether drop=FALSE or drop=TRUE should be the
    TL> default. The decision has always been that programmers
    TL> can cope either way, but that users probably don't
    TL> expect mtx[,1] to be a vector, and that they definitely
    TL> don't expect mtx[1,1] to be a matrix.

Yes, and (as Uwe has already mentioned),
the S language has now been ``defined'' in a few ways for 
many years, and the decision to make "drop=TRUE" the default
(for arrays at least) may have been sub-optimal --- and maybe
could have been changed 15 years ago,  but not anymore nowadays:
It is implicitly made use of in too many places of existing S code.

Those of you who are new to R:  
Please don't assume R is new just because you are new to it!

Martin