我想构建一个向配方添加步骤的函数,但我不知道如何使用add_step
. 文档中没有示例也无济于事。
这是我尝试过的:
suppressPackageStartupMessages(library(recipes))
rec1 <- recipe(data = mtcars, mpg ~ disp + hp)
rec1
#> Data Recipe
#>
#> Inputs:
#>
#> role #variables
#> outcome 1
#> predictor 2
rec2 <- add_step(rec = rec1, step_mutate(hp = 1))
#> Error in add_step(recipe, step_mutate_new(terms = terms, trained = trained, : argument "recipe" is missing, with no default
由reprex 包(v0.3.0)于 2020-02-24 创建