orbital_r_fun {orbital} | R Documentation |
Turn orbital object into a R function
Description
Returns a R file that contains a function that output predictions when applied to data frames.
Usage
orbital_r_fun(x, name = "orbital_predict", file)
Arguments
x |
An orbital object. |
name |
Name of created function. Defaults to '"orbital_predict"“. |
file |
A file name. |
Details
The generated function is only expected to work on data frame objects. The generated function doesn't require the orbital package to be loaded. Depending on what models and steps are used, other packages such as dplyr will need to be loaded as well.
Value
Nothing.
Examples
library(workflows)
library(recipes)
library(parsnip)
rec_spec <- recipe(mpg ~ ., data = mtcars) %>%
step_normalize(all_numeric_predictors())
lm_spec <- linear_reg()
wf_spec <- workflow(rec_spec, lm_spec)
wf_fit <- fit(wf_spec, mtcars)
orbital_obj <- orbital(wf_fit)
file_name <- tempfile()
orbital_r_fun(orbital_obj, file = file_name)
readLines(file_name)
[Package orbital version 0.2.0 Index]