Determine required packages for a model
Determine required packages for a model
req_pkgs(x, ...) ## S3 method for class 'model_spec' req_pkgs(x, ...) ## S3 method for class 'model_fit' req_pkgs(x, ...)
x |
A model specification or fit. |
... |
Not used. |
For a model specification, the engine must be set.
The list does not include the parsnip
package.
A character string of package names (if any).
should_fail <- try(req_pkgs(linear_reg()), silent = TRUE) should_fail linear_reg() %>% set_engine("glmnet") %>% req_pkgs() linear_reg() %>% set_engine("lm") %>% fit(mpg ~ ., data = mtcars) %>% req_pkgs()
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.