Skip to contents

Takes in a recipe and will scale values using a selected recipe.

Usage

hai_data_poly(.recipe_object = NULL, ..., .p_degree = 2)

Arguments

.recipe_object

The data that you want to process

...

One or more selector functions to choose variables to be imputed. When used with imp_vars, these dots indicate which variables are used to predict the missing data in each variable. See selections() for more details

.p_degree

The polynomial degree, an integer.

Value

A list object

Details

This function will get your data ready for processing with many types of ml/ai models.

This is intended to be used inside of the data processor and therefore is an internal function. This documentation exists to explain the process and help the user understand the parameters that can be set in the pre-processor function.

recipes::step_poly()

Author

Steven P. Sanderson II, MPH

Examples

suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(recipes))

date_seq <- seq.Date(from = as.Date("2013-01-01"), length.out = 100, by = "month")
val_seq <- rep(rnorm(10, mean = 6, sd = 2), times = 10)
df_tbl <- tibble(
  date_col = date_seq,
  value    = val_seq
)

rec_obj <- recipe(value ~ ., df_tbl)

hai_data_poly(
  .recipe_object = rec_obj,
  value
)$scale_rec_obj %>%
  get_juiced_data()
#> # A tibble: 100 × 3
#>    date_col   value_poly_1 value_poly_2
#>    <date>            <dbl>        <dbl>
#>  1 2013-01-01      -0.117       0.115  
#>  2 2013-02-01      -0.0422     -0.0588 
#>  3 2013-03-01       0.0243     -0.115  
#>  4 2013-04-01      -0.0537     -0.0397 
#>  5 2013-05-01       0.0119     -0.111  
#>  6 2013-06-01       0.133      -0.00535
#>  7 2013-07-01      -0.0932      0.0468 
#>  8 2013-08-01      -0.113       0.101  
#>  9 2013-09-01       0.0512     -0.111  
#> 10 2013-10-01       0.198       0.177  
#> # ℹ 90 more rows