Skip to content

[idea] return a list + print method #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Athospd opened this issue Jun 18, 2020 · 1 comment
Open

[idea] return a list + print method #3

Athospd opened this issue Jun 18, 2020 · 1 comment
Labels
feature a feature request or enhancement

Comments

@Athospd
Copy link

Athospd commented Jun 18, 2020

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.

@topepo
Copy link
Member

topepo commented Aug 17, 2020

Great idea. Go for it!

@juliasilge juliasilge added the feature a feature request or enhancement label Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants