On Tue, Sep 26, 2017 at 12:15 PM, Patrick Perry <ppe...@stern.nyu.edu> wrote: > Pro ignoring x[,1,drop=TRUE]: > (1) it forces users to write consistent code for extracting a vector from a > data frame > > Con: > (1) functions that accept both matrices and data frames might break > (x[[j]][i] doesn't work for a matrix)
I generally think that it's better to keep matrices and data frame completely separate, but point taken. > (2) functions that use the access pattern x[i,j,drop = TRUE] will break This seems pretty rare, and I don't think anyone has complained about it yet. I don't love adding support for drop = TRUE because it makes [.tibble type-unstable, but maybe it's reasonable to do so in order to slightly improve backward compatibility. I've filed an issue so we consider it for the next major release: https://github.com/tidyverse/tibble/issues/311 > Perhaps a bigger issue with tibbles is that they don't let you index with > row names: > >> y <- tibble(x = letters) >> rownames(y) > [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" > "15" > [16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" >> y[rownames(y)[c(1,5,9,15,21)],] > # A tibble: 5 x 1 > x > <chr> > 1 <NA> > 2 <NA> > 3 <NA> > 4 <NA> > 5 <NA> I'd argue that this is not as big as an issue, as I have no recollection of anyone complaining about it. Hadley -- http://hadley.nz ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel