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 .default arg in case_when() #1017

Merged
merged 5 commits into from
Oct 6, 2022
Merged

Support .default arg in case_when() #1017

merged 5 commits into from
Oct 6, 2022

Conversation

mgirlich
Copy link
Collaborator

@mgirlich mgirlich commented Oct 5, 2022

No description provided.

if (is_true(formulas[[n]][[2]])) {
clauses[[n]] <- paste0("ELSE ", value[[n]])
} else if (!is_null(.default)) {
clauses[[n + 1]] <- paste0("ELSE ", .default)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This feels a bit hacky. But this should give the same behaviour as dplyr.

@mgirlich mgirlich requested a review from hadley October 6, 2022 06:12
@mgirlich mgirlich merged commit ec2374f into main Oct 6, 2022
@mgirlich mgirlich deleted the case_when-default-arg branch October 6, 2022 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants