New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x[1,,drop = TRUE] should return a list #367
Comments
Thanks, agreed. We're supporting the |
I think you have some leeway here for what to do for the following cases: x <- mtcars[1, ]
x[, , drop = TRUE]
y <- mtcars[, 1, drop = FALSE]
y[, , drop = TRUE]
z <- mtcars[1, 1, drop = FALSE]
z[, , drop = TRUE] A In my own implementation in the Probably no one actually uses this construct, so do whatever makes the implementation easiest. |
Following up, this is the corner case that actually matters: x <- data.frame(foo = 31337)
x[1, , drop = TRUE] A |
I think users should always use |
This seems to only require splitting the attributes from the resulting list (including |
- `tbl[1, , drop = TRUE]` now behaves identically to data frames (#367).
Closed in 35dfee5. |
- `enframe(NULL)` now returns the same as `enframe(logical())` (#352). - `tbl[1, , drop = TRUE]` now behaves identically to data frames (#367). - The `tibble.width` option is honored again (#369). - Faster printing of very wide tibbles (#360). - Update vignette to match changes in 1.4.1 (#368, @bgreenwell). - Don't rely on `ncol()` for `glimpse()`, only query `nrow()` and `head()`. - Return input for zero-column data frames. - Add test for `glimpse()` with unknown rows (#366, @kevinykuo). - Faster construction and subsetting for tibbles (#353). - `tribble()` now ignores trailing commas (#342, @LaDilettante). - Fix error message when accessing columns using a logical index vector (#337, @mundl).
Bug fixes --------- - Fix OS X builds. - The `tibble.width` option is honored again (#369). - `tbl[1, , drop = TRUE]` now behaves identically to data frames (#367). - Fix error message when accessing columns using a logical index vector (#337, @mundl). - `glimpse()` returns its input for zero-column data frames. Features -------- - `enframe(NULL)` now returns the same as `enframe(logical())` (#352). - `tribble()` now ignores trailing commas (#342, @LaDilettante). - Updated vignettes and website documentation. Performance ----------- - Faster printing of very wide tibbles (#360). - Faster construction and subsetting for tibbles (#353). - Only call `nrow()` and `head()` in `glimpse()`, not `ncol()`.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
Currently tibble behavior with
drop = TRUE
is consistent withdata.frame
for extracting a single column, but not for extracting a single row:The
data.frame
behavior makes more sense to me here, because it fits with the general pattern that ifx
is a matrix-like object, thenx[1,,drop = TRUE]
returns a vector-like object.Related: #311
The text was updated successfully, but these errors were encountered: