Learn R Programming

nestedmodels (version 1.1.0)

nested: Create a Nested Model

Description

nested() turns a model or workflow into a nested model/workflow. is_nested() checks if a model or workflow is nested.

Usage

nested(x, ...)

is_nested(x, ...)

# S3 method for default nested(x, ...)

# S3 method for model_spec nested(x, allow_par = FALSE, pkgs = NULL, ...)

# S3 method for nested_model nested(x, allow_par = FALSE, pkgs = NULL, ...)

# S3 method for workflow nested(x, allow_par = FALSE, pkgs = NULL, ...)

# S3 method for default is_nested(x, ...)

# S3 method for model_spec is_nested(x, ...)

# S3 method for workflow is_nested(x, ...)

Value

A nested model object, or a workflow containing a nested model. For is_nested(), a logical vector of length 1.

Arguments

x

A model specification or workflow.

...

Not currently used.

allow_par

A logical to allow parallel processing over nests during the fitting process (if a parallel backend is registered).

pkgs

An optional character string of R package names that should be loaded (by namespace) during parallel processing.

Examples

Run this code

library(parsnip)
library(workflows)

model <- linear_reg() %>%
  set_engine("lm") %>%
  nested()

model

is_nested(model)

wf <- workflow() %>%
  add_model(model)

is_nested(wf)

Run the code above in your browser using DataLab