step_harmonic
step_harmonic.Rd
Add sin and cos terms for harmonic analysis
Usage
step_harmonic(
.rec,
terms,
frequency = NA_real_,
cycle_size = NA_real_,
starting_value = 0,
role = "predictor",
skip = FALSE,
keep_original_cols = FALSE,
...
)
Arguments
- .rec
the R6 recipe object.
- terms
the unquoted names of the variables to use or a selector function. terms replaces the `...` of the recipes package but requires variables to be included within `c()`. For example to include variables x and y you would write `c(x,y)` in the hydrorecipes package.
- frequency
numeric vector - the frequencies of the sin and cos curves
- cycle_size
numeric - the period of the sin and cos curves
- starting_value
numeric - the starting position of the sin and cos curves. This may be specified to have more control over the signal phase.
- role
character - the name of the role
- skip
logical - should the step be skipped
- keep_original_cols
logical - keep the original columns or replace them
- ...
additional arguments
Examples
dat <- data.frame(x = 1:10, y = rnorm(10))
rec <- recipe(y~x, data = dat) |>
step_harmonic(x,
frequency = 2.0,
cycle_size = 4.0,
starting_value = 0.0)