spsanderson / healthyR.ai

healthyR.ai - AI package for the healthyverse
http://www.spsanderson.com/healthyR.ai/
Other
16 stars 6 forks source link

`step_hai_` functions are failing. #306

Closed spsanderson closed 1 year ago

spsanderson commented 1 year ago
### ** Examples

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

len_out <- 10
by_unit <- "month"
start_date <- as.Date("2021-01-01")

data_tbl <- tibble(
  date_col = seq.Date(from = start_date, length.out = len_out, by = by_unit),
  a = rnorm(len_out),
  b = runif(len_out)
)

# Create a recipe object
rec_obj <- recipe(a ~ ., data = data_tbl) %>%
  step_hai_fourier(b, scale_type = "sin") %>%
  step_hai_fourier(b, scale_type = "cos") %>%
  step_hai_fourier(b, scale_type = "sincos")

# View the recipe object
rec_obj
Recipe

Inputs:

      role #variables
   outcome          1
 predictor          2

Operations:

Fourier Transformation on b
Fourier Transformation on b
Fourier Transformation on b

# Prepare the recipe object
prep(rec_obj)
Error in `prep()`:
! All variables for `step_hai_fourier` must be `numeric``integer` `double` classes.

# Bake the recipe object - Adds the Time Series Signature
bake(prep(rec_obj), data_tbl)
Error in `prep()`:
! All variables for `step_hai_fourier` must be `numeric``integer` `double` classes.

rec_obj %>% get_juiced_data()
Error in `prep()`:
! All variables for `step_hai_fourier` must be `numeric``integer` `double` classes.