Open
Description
Hello @topepo
Imagine if foo <- usemodels::use_xgboost(mpg~., mtcars)
would return a list of code chunks, like
foo <- list();
foo$recipe <- "xgb_recipe <-
recipe(formula = mpg ~ ., data = mtcars) %>%
step_zv(all_predictors()) "
foo$recipe
#> [1] "xgb_recipe <- \n recipe(formula = mpg ~ ., data = mtcars) %>% \n step_zv(all_predictors()) "
cat(foo$recipe)
#> xgb_recipe <-
#> recipe(formula = mpg ~ ., data = mtcars) %>%
#> step_zv(all_predictors())
Created on 2020-06-18 by the reprex package (v0.3.0)
It would suit perfectly for build custom rstudio snippets programatically, like this one by @RobertMyles https://www.robertmylesmcdonnell.com/content/posts/modelscript/
The cat()'s could live inside a print() S3 method...
I would love to contribute with this if it sounds like a good idea.