-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add locale argument to step_date()
#1000
Comments
Issue 1000!!! 🎉 🎉 😆 |
Full reprex library(recipes)
Sys.setlocale("LC_TIME", 'fr_FR.UTF-8')
#> [1] "fr_FR.UTF-8"
examples <- tibble(someday = lubridate::ymd("2000-12-20") + lubridate::days(0:40))
rec <- recipe(~ someday, examples) %>%
step_date(all_predictors()) %>%
prep()
rec %>%
bake(new_data = examples)
#> # A tibble: 41 × 4
#> someday someday_dow someday_month someday_year
#> <date> <fct> <fct> <dbl>
#> 1 2000-12-20 Mer déc 2000
#> 2 2000-12-21 Jeu déc 2000
#> 3 2000-12-22 Ven déc 2000
#> 4 2000-12-23 Sam déc 2000
#> 5 2000-12-24 Dim déc 2000
#> 6 2000-12-25 Lun déc 2000
#> 7 2000-12-26 Mar déc 2000
#> 8 2000-12-27 Mer déc 2000
#> 9 2000-12-28 Jeu déc 2000
#> 10 2000-12-29 Ven déc 2000
#> # … with 31 more rows
Sys.setlocale("LC_TIME", 'en_GB.UTF-8')
#> [1] "en_GB.UTF-8"
rec %>%
bake(new_data = examples)
#> # A tibble: 41 × 4
#> someday someday_dow someday_month someday_year
#> <date> <fct> <fct> <dbl>
#> 1 2000-12-20 <NA> <NA> 2000
#> 2 2000-12-21 <NA> <NA> 2000
#> 3 2000-12-22 <NA> <NA> 2000
#> 4 2000-12-23 <NA> <NA> 2000
#> 5 2000-12-24 <NA> <NA> 2000
#> 6 2000-12-25 <NA> <NA> 2000
#> 7 2000-12-26 <NA> <NA> 2000
#> 8 2000-12-27 <NA> <NA> 2000
#> 9 2000-12-28 <NA> <NA> 2000
#> 10 2000-12-29 <NA> <NA> 2000
#> # … with 31 more rows Created on 2022-06-07 by the reprex package (v2.0.1) |
Merged
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex https://reprex.tidyverse.org) and link to this issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Thanks to @cderv for highlighting this problem:
Created on 2022-06-07 by the reprex package (v2.0.1)
I had deployed a workflow that used
step_date()
, and he could not predict from it locally because of the language difference.We could:
prep()
time the transformations used so they can be applied atbake()
timeThe text was updated successfully, but these errors were encountered: