[R] omitting integer(0) rows from data frame

Gerrit Eichner Gerrit.Eichner at math.uni-giessen.de
Wed Oct 30 14:18:40 CET 2013


Hi, Jack,

well, I disagree: What do you expect to grab out of a bucket (= data 
frame) if you do not at all grab into it (indexing with an _empty_ index, 
i.e. with nothing)? And changing the sign of nothing is still nothing ...

  Hth --  Gerrit

On Wed, 30 Oct 2013, Jack Tanner wrote:

> I'm not sure if this is correct behavior or not, but it seems counterintuitive
> to me:
>
> dat <- data.frame(id=1:5, let=letters[1:5])
> # A. omits the first row
> dat[- 1, ]
>
> # B. unexpectedly omits ALL rows
> dat[- integer(0), ]
>
> It would be less surprising if there were no rows omitted in the (B) case.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list