The new step_harmonic() should not have NA here because it creates new columns:
Even if I do manually set it to "predictor" something is going wrong with the printing:
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
data(sunspot.year)
sunspots <-
tibble(year = 1700:1988,
n_sunspot = sunspot.year)
rec <-
recipe(n_sunspot ~ year, data = sunspots) %>%
step_harmonic(year, frequency = 1 / 11, cycle_size = 1,
role = "predictor")
prep(rec)
#> Recipe
#>
#> Inputs:
#>
#> role #variables
#> outcome 1
#> predictor 1
#>
#> Training data contained 289 data points and no missing data.
#>
#> Operations:
#>
#> Harmonic numeric variables for
#> Error in if (nchar(txt) == 0) txt <- "<none>": argument is of length zero
Created on 2021-09-27 by the reprex package (v2.0.1)
The new
step_harmonic()should not haveNAhere because it creates new columns:recipes/R/harmonic.R
Line 134 in 33b18bf
Even if I do manually set it to "predictor" something is going wrong with the printing:
Created on 2021-09-27 by the reprex package (v2.0.1)