[R] data.frame's and [2, c(T, F)] in R 2.6.0

data-ploner.com info at data-ploner.com
Mon Oct 8 17:05:22 CEST 2007


On Oct 8, 2007, at 4:58 PM, Peter Dalgaard wrote:

> data-ploner.com wrote:
>> In R prior to 2.6.0 with matrizes as well as with data.frames it is
>> possible to do:
>>
>> a[2, c(TRUE, FALSE)]
>>
>> In R 2.6.0 the mixed indexing works only for matrizes. Is this the
>> intention, a bug, or did I get something wrong?
>> Best regards
>>
>> Meinhard
>>
>>
> It looks unintentional, but it is not due to "mixed indexing":
>
>> a[TRUE,c(TRUE,FALSE)]
> Error in .subset2(xx, j) : attempt to select less than one element
>> a[2,c(TRUE,TRUE)]
>   a b
> 2 2 5
>
> As far as I can tell, It happens only when drop=TRUE and exactly one
> column is selected using a logical index.

Thank you.
Maybe it is better letting [] work as in previous R ... ?

Meinhard Ploner

>
> --  
>    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45)  
> 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45)  
> 35327907
>
>
>

Meinhard Ploner
Althingstrasse 15
39031 Bruneck

P.IVA 0234 058 0212
Tel. +39 340 8937861

info at data-ploner.com



More information about the R-help mailing list