required_pkgs.model_spec: Determine required packages for a model

View source: R/required_pkgs.R

required_pkgs.model_specR 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()


parsnip documentation built on June 24, 2024, 5:14 p.m.