Hello,

Currently, subset.data.frame() does

   if (missing(subset))
           r <- TRUE
       else {

perhaps better might be:

   if (missing(subset))
           r <- rep(TRUE, nrow(x))
       else {

The rationale being, if 'x' has zero rows and 'subset' is missing, we don't want to end up with more rows than we started with:

    > subset(head(iris, 0), select = -Species)
      Sepal.Length Sepal.Width Petal.Length Petal.Width
   NA           NA          NA           NA          NA

Thoughts?
-Ben
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to