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

Fix error message in check_names_df.logical() #337

Merged
merged 1 commit into from Jan 15, 2018

Conversation

Projects
None yet
2 participants
@mundl
Contributor

mundl commented Nov 21, 2017

Fix error message for logical index vector of wrong length

Fix error message in check_names_df.logical()
Fix error message for logical index vector of wrong length
@mundl

This comment has been minimized.

Owner

mundl commented on 499fbf7 Nov 21, 2017

Example data with 5 columns

library(tibble)
i <- as_data_frame(iris)

Selecting the first 4 columns with a logical vector of length 5

num <- c(rep(TRUE, 4), FALSE)
i[, num]

Using a vector of length 6 gives the error message:

num2 <- c(num, FALSE)
i[, num2]

Error: Length of logical index vector must be 1 or 5 (the number of rows), not 6

which should rather be

Error: Length of logical index vector must be 1 or 5 (the number of columns), not 6

Sorry, I forgot to append the changes to the unit test files to this pull request.

@krlmlr krlmlr merged commit b5bd5f0 into tidyverse:master Jan 15, 2018

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details
@krlmlr

This comment has been minimized.

Member

krlmlr commented Jan 15, 2018

Thanks!

@krlmlr

This comment has been minimized.

Member

krlmlr commented Jan 15, 2018

If you want to update a pull request, you can just push to the same branch. I fixed the tests myself (101e35a).

krlmlr added a commit that referenced this pull request Jan 20, 2018

Merge tag 'v1.4.1.9001'
- `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).

krlmlr added a commit that referenced this pull request Jan 23, 2018

Merge tag 'v1.4.2'
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()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment