Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

req_pkgs

Determine required packages for a model


Description

Determine required packages for a model

Usage

req_pkgs(x, ...)

## S3 method for class 'model_spec'
req_pkgs(x, ...)

## S3 method for class 'model_fit'
req_pkgs(x, ...)

Arguments

x

A model specification or fit.

...

Not used.

Details

For a model specification, the engine must be set.

The list does not include the parsnip package.

Value

A character string of package names (if any).

Examples

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()

parsnip

A Common API to Modeling and Analysis Functions

v0.1.5
GPL-2
Authors
Max Kuhn [aut, cre], Davis Vaughan [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.