required_pkgs.model_spec {parsnip} | R Documentation |
Determine required packages for a model
Description
Determine required packages for a model
Usage
## S3 method for class 'model_spec'
required_pkgs(x, infra = TRUE, ...)
## S3 method for class 'model_fit'
required_pkgs(x, infra = TRUE, ...)
Arguments
x |
A model specification or fit. |
infra |
Should parsnip itself be included in the result? |
... |
Not used. |
Value
A character vector
Examples
should_fail <- try(required_pkgs(linear_reg(engine = NULL)), silent = TRUE)
should_fail
linear_reg() %>%
set_engine("glmnet") %>%
required_pkgs()
linear_reg() %>%
set_engine("glmnet") %>%
required_pkgs(infra = FALSE)
linear_reg() %>%
set_engine("lm") %>%
fit(mpg ~ ., data = mtcars) %>%
required_pkgs()
[Package parsnip version 1.2.1 Index]