-
Notifications
You must be signed in to change notification settings - Fork 57
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
Translation from case_when
to fcase()
will throw error when T
is used instead of TRUE
.
#272
Comments
gitgud5000
changed the title
Jul 19, 2021
case_when
fails if T
is used insteaRUEd of TRUEcase_when
fails if T
is used instead of TRUE
gitgud5000
changed the title
Jul 19, 2021
case_when
fails if T
is used instead of TRUE
case_when
fails whenT
is used instead of TRUE
gitgud5000
changed the title
Jul 19, 2021
case_when
fails whenT
is used instead of TRUE
case_when
fails when T
is used instead of TRUE
gitgud5000
changed the title
Translation from Jul 19, 2021
case_when
fails when T
is used instead of TRUE
case_when
to fcase()
will throw error when T
is used instead of TRUE
.
Thanks for catching this. I added a fix in #269 that will address this issue once it's merged. |
@NZambranoc All set library(dplyr, warn.conflicts = FALSE)
library(dtplyr)
iris %>%
lazy_dt() %>%
mutate(new_col = case_when(Sepal.Length > 4.5 ~ "foo",
T ~ "bar"))
#> Source: local data table [150 x 6]
#> Call: copy(`_DT1`)[, `:=`(new_col = fcase(Sepal.Length > 4.5, "foo",
#> rep(TRUE, .N), "bar"))]
#>
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species new_col
#> <dbl> <dbl> <dbl> <dbl> <fct> <chr>
#> 1 5.1 3.5 1.4 0.2 setosa foo
#> 2 4.9 3 1.4 0.2 setosa foo
#> 3 4.7 3.2 1.3 0.2 setosa foo
#> 4 4.6 3.1 1.5 0.2 setosa foo
#> 5 5 3.6 1.4 0.2 setosa foo
#> 6 5.4 3.9 1.7 0.4 setosa foo
#> # … with 144 more rows
#>
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When calling
T
instead ofTRUE
inside this a case_when using dplyr causes the function to fail.This works:
This breaks:
Error message output to the console:
The text was updated successfully, but these errors were encountered: