Skip to content
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

Support zero-length vectors in case_when() #3048

Merged
merged 6 commits into from Aug 23, 2017

Conversation

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Aug 23, 2017

Closes #3041.

The second commit is optional, it simplifies error handling but the message is less verbose.

@krlmlr krlmlr requested a review from hadley Aug 23, 2017
@@ -32,7 +32,7 @@ test_that("cases must yield compatible lengths", {
c(TRUE, FALSE) ~ 1,
c(FALSE, TRUE, FALSE) ~ 2
),
"LHS of case 1 (`c(TRUE, FALSE)`) must be length 3 (the longest input) or one, not 2",
"All conditions and values must be length 1 or 2 (the first non-atomic value), not 3",
Copy link
Member

@hadley hadley Aug 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say remove the parenthetical ("(the first non-atomic value)") and be more precise about the failures:

All conditions and values must be length 1 or 2.
Problems at the following locations: 2.

Loading

@krlmlr
Copy link
Member Author

@krlmlr krlmlr commented Aug 23, 2017

@hadley: The error message now quotes the failing arguments verbatim, for consistency with other error messages.

Loading

hadley
hadley approved these changes Aug 23, 2017
@krlmlr krlmlr merged commit e66ddd6 into tidyverse:master Aug 23, 2017
1 of 2 checks passed
Loading
@krlmlr krlmlr deleted the b-#3041-case-when-zero branch Aug 23, 2017
@lock
Copy link

@lock lock bot commented Jan 18, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

Loading

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants