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

Translated named args in if_else() #234

Merged
merged 11 commits into from
Mar 31, 2021

Conversation

markfairbanks
Copy link
Collaborator

reprex of issue fixed:

library(data.table)
library(dplyr)
library(dtplyr)

test_df <- data.table(x = c("a", "a", "b", NA))

test_df %>%
  mutate(if_x = if_else(x == "a", true = 1, false = 0, missing = NULL))
#> Error in fifelse(x == "a", true = 1, false = 0, missing = NULL): unused arguments (true = 1, false = 0, missing = NULL)

R/tidyeval.R Outdated Show resolved Hide resolved
@markfairbanks
Copy link
Collaborator Author

All set for review

@@ -56,6 +56,46 @@ test_that("translate context functions", {
expect_equal(capture_dot(dt, cur_group_rows()), quote(.I))
})


test_that("translates if_else()/ifelse()", {
Copy link
Member

Choose a reason for hiding this comment

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

I refactored the tests a little bit — these tests somehow ended up in the wrong place which lead to using show_query() instead of the simpler capture_dot(). I also split out the tests for coalesce since the ifelse tests are reasonably complicated.

Since it's only a dev dep, and reseting options fails on R 3.5 and earlier
@hadley hadley merged commit c692b92 into tidyverse:master Mar 31, 2021
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