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

step_holiday() broken in 1.0.0 #1019

Closed
joranE opened this issue Jul 1, 2022 · 2 comments · Fixed by #1020
Closed

step_holiday() broken in 1.0.0 #1019

joranE opened this issue Jul 1, 2022 · 2 comments · Fixed by #1020
Labels
bug an unexpected problem or unintended behavior

Comments

@joranE
Copy link

joranE commented Jul 1, 2022

The problem

step_holiday() no longer identifies any holidays, it produces columns of just 0's in version 1.0.0.

Reproducible example

I'm just running the example in ?step_holiday():

``` r
library(recipes)
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
#> 
#> Attaching package: 'recipes'
#> The following object is masked from 'package:stats':
#> 
#>     step
library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union

examples <- data.frame(someday = ymd("2000-12-20") + days(0:40))
holiday_rec <- recipe(~someday, examples) %>%
    step_holiday(all_predictors())

holiday_rec <- prep(holiday_rec, training = examples)
holiday_values <- bake(holiday_rec, new_data = examples)
holiday_values
#> # A tibble: 41 × 4
#>    someday    someday_LaborDay someday_NewYearsDay someday_ChristmasDay
#>    <date>                <dbl>               <dbl>                <dbl>
#>  1 2000-12-20                0                   0                    0
#>  2 2000-12-21                0                   0                    0
#>  3 2000-12-22                0                   0                    0
#>  4 2000-12-23                0                   0                    0
#>  5 2000-12-24                0                   0                    0
#>  6 2000-12-25                0                   0                    0
#>  7 2000-12-26                0                   0                    0
#>  8 2000-12-27                0                   0                    0
#>  9 2000-12-28                0                   0                    0
#> 10 2000-12-29                0                   0                    0
#> # … with 31 more rows

Created on 2022-07-01 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info  🇩🇲  🙌🏾  👨🏾‍🦲   ─────────────────────────────────────────────────
#>  hash: flag: Dominica, raising hands: medium-dark skin tone, man: medium-dark skin tone, bald
#> 
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       macOS Monterey 12.0.1
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       America/Denver
#>  date     2022-07-01
#>  pandoc   2.14.0.3 @ /Applications/RStudio.app/Contents/MacOS/pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package      * version    date (UTC) lib source
#>  assertthat     0.2.1      2019-03-21 [1] CRAN (R 4.0.0)
#>  backports      1.3.0      2021-10-27 [1] CRAN (R 4.1.1)
#>  class          7.3-19     2021-05-03 [2] CRAN (R 4.1.2)
#>  cli            3.3.0      2022-04-25 [1] CRAN (R 4.1.1)
#>  codetools      0.2-18     2020-11-04 [2] CRAN (R 4.1.2)
#>  crayon         1.4.2      2021-10-29 [1] CRAN (R 4.1.1)
#>  DBI            1.1.1      2021-01-15 [1] CRAN (R 4.1.0)
#>  digest         0.6.28     2021-09-23 [1] CRAN (R 4.1.1)
#>  dplyr        * 1.0.7      2021-06-18 [1] CRAN (R 4.1.0)
#>  ellipsis       0.3.2      2021-04-29 [1] CRAN (R 4.1.0)
#>  evaluate       0.14       2019-05-28 [1] CRAN (R 4.0.0)
#>  fansi          0.5.0      2021-05-25 [1] CRAN (R 4.1.0)
#>  fastmap        1.1.0      2021-01-25 [1] CRAN (R 4.1.0)
#>  fs             1.5.0      2020-07-31 [1] CRAN (R 4.1.0)
#>  future         1.23.0     2021-10-31 [1] CRAN (R 4.1.1)
#>  future.apply   1.8.1-9001 2021-10-13 [1] Github (HenrikBengtsson/future.apply@f04209f)
#>  generics       0.1.2      2022-01-31 [1] CRAN (R 4.1.1)
#>  globals        0.14.0     2020-11-22 [1] CRAN (R 4.1.0)
#>  glue           1.6.2      2022-02-24 [1] CRAN (R 4.1.1)
#>  gower          0.2.2      2020-06-23 [1] CRAN (R 4.1.0)
#>  hardhat        1.2.0      2022-06-30 [1] CRAN (R 4.1.2)
#>  highr          0.9        2021-04-16 [1] CRAN (R 4.1.0)
#>  htmltools      0.5.2      2021-08-25 [1] CRAN (R 4.1.1)
#>  ipred          0.9-12     2021-09-15 [1] CRAN (R 4.1.1)
#>  knitr          1.36       2021-09-29 [1] CRAN (R 4.1.1)
#>  lattice        0.20-45    2021-09-22 [2] CRAN (R 4.1.2)
#>  lava           1.6.10     2021-09-02 [1] CRAN (R 4.1.0)
#>  lifecycle      1.0.1      2021-09-24 [1] CRAN (R 4.0.2)
#>  listenv        0.8.0      2019-12-05 [1] CRAN (R 4.1.0)
#>  lubridate    * 1.8.0      2021-10-07 [1] CRAN (R 4.1.1)
#>  magrittr       2.0.1      2020-11-17 [1] CRAN (R 4.1.0)
#>  MASS           7.3-54     2021-05-03 [2] CRAN (R 4.1.2)
#>  Matrix         1.3-4      2021-06-01 [2] CRAN (R 4.1.2)
#>  nnet           7.3-16     2021-05-03 [2] CRAN (R 4.1.2)
#>  parallelly     1.28.1     2021-09-09 [1] CRAN (R 4.1.0)
#>  pillar         1.7.0      2022-02-01 [1] CRAN (R 4.1.1)
#>  pkgconfig      2.0.3      2019-09-22 [1] CRAN (R 4.0.0)
#>  prodlim        2019.11.13 2019-11-17 [1] CRAN (R 4.1.0)
#>  purrr          0.3.4      2020-04-17 [1] CRAN (R 4.1.0)
#>  R.cache        0.15.0     2021-04-30 [1] CRAN (R 4.1.0)
#>  R.methodsS3    1.8.1      2020-08-26 [1] CRAN (R 4.1.0)
#>  R.oo           1.24.0     2020-08-26 [1] CRAN (R 4.1.0)
#>  R.utils        2.11.0     2021-09-26 [1] CRAN (R 4.1.1)
#>  R6             2.5.1      2021-08-19 [1] CRAN (R 4.1.1)
#>  Rcpp           1.0.7      2021-07-07 [1] CRAN (R 4.1.0)
#>  recipes      * 1.0.0      2022-07-01 [1] CRAN (R 4.1.2)
#>  reprex         2.0.1      2021-08-05 [1] CRAN (R 4.1.0)
#>  rlang          1.0.3      2022-06-27 [1] CRAN (R 4.1.2)
#>  rmarkdown      2.11       2021-09-14 [1] CRAN (R 4.1.1)
#>  rpart          4.1-15     2019-04-12 [2] CRAN (R 4.1.2)
#>  rstudioapi     0.13       2020-11-12 [1] CRAN (R 4.0.2)
#>  sessioninfo    1.2.1      2021-11-02 [1] CRAN (R 4.1.1)
#>  stringi        1.7.5      2021-10-04 [1] CRAN (R 4.1.1)
#>  stringr        1.4.0      2019-02-10 [1] CRAN (R 4.1.1)
#>  styler         1.6.2      2021-09-23 [1] CRAN (R 4.1.1)
#>  survival       3.2-13     2021-08-24 [2] CRAN (R 4.1.2)
#>  tibble         3.1.7      2022-05-03 [1] CRAN (R 4.1.1)
#>  tidyr          1.1.4      2021-09-27 [1] CRAN (R 4.1.2)
#>  tidyselect     1.1.2      2022-02-21 [1] CRAN (R 4.1.1)
#>  timeDate       3043.102   2018-02-21 [1] CRAN (R 4.1.0)
#>  utf8           1.2.2      2021-07-24 [1] CRAN (R 4.1.0)
#>  vctrs          0.4.1      2022-04-13 [1] CRAN (R 4.1.1)
#>  withr          2.4.2      2021-04-18 [1] CRAN (R 4.0.2)
#>  xfun           0.28       2021-11-04 [1] CRAN (R 4.1.1)
#>  yaml           2.2.1      2020-02-01 [1] CRAN (R 4.1.0)
#> 
#>  [1] /Users/elias/RLibs
#>  [2] /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
```
@EmilHvitfeldt EmilHvitfeldt added the bug an unexpected problem or unintended behavior label Jul 1, 2022
@EmilHvitfeldt
Copy link
Member

Hello @joranE Thanks for catching this so fast! I have fixed the bug in #1020

@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants