step_harmonic: Generate harmonics

Description Usage Arguments Details Value See Also Examples

View source: R/step_harmonic.R

Description

'step_harmonic' creates a *specification* of a recipe step for harmonics (sin and cos terms).

Usage

1
2
3
step_harmonic(recipe, ..., role = "harmonic", trained = FALSE,
  freq = 1, prefix = "harmonic_", default = NA, columns = NULL,
  skip = FALSE, id = rand_id("harmonic"))

Arguments

recipe

A recipe object. The step will be added to the sequence of operations for this recipe.

...

One or more selector functions to choose which variables are affected by the step. See [selections()] for more details. For the 'tidy' method, these are not currently used.

role

Defaults to "harmonic"

trained

A logical to indicate if the quantities for preprocessing have been estimated.

freq

numeric vector frequencies for sin and cos

prefix

A prefix for generated column names, default to "harmonic_".

default

Passed to dplyr::lag, determines what fills empty rows left by lagging (defaults to NA).

columns

A character string of variable names that will be populated (eventually) by the terms argument.

skip

A logical. Should the step be skipped when the recipe is baked by bake.recipe()? While all operations are baked when prep.recipe() is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when using skip = TRUE as it may affect the computations for subsequent operations

id

A character string that is unique to this step to identify it.

Details

'step_harmonic' calculates the Earth tide harmonics

Value

An updated version of 'recipe' with the new step added to the sequence of existing steps (if any). For the 'tidy' method, a tibble with columns 'terms' which is the columns that will be affected and 'holiday'.

See Also

[step_earthtide()] [recipe()] [prep.recipe()] [bake.recipe()]

Examples

1
2
3
4
5
6
7
8
9
data(transducer)

rec <- recipe(wl ~ .,
              data = transducer[1:1000, list(datetime, wl)])

with_et <- rec %>%
  step_harmonic(datetime, freq = c(1, 1.93, 2)) %>% 
  prep() %>%
  juice()

jkennel/waterlevel documentation built on Dec. 1, 2019, 6:24 p.m.