View source: R/write-plumber.R
vetiver_write_plumber | R Documentation |
Use vetiver_write_plumber()
to create a plumber.R
file for a
vetiver_model()
that has been versioned and stored via
vetiver_pin_write()
.
vetiver_write_plumber(
board,
name,
version = NULL,
...,
file = "plumber.R",
rsconnect = TRUE,
additional_pkgs = character(0)
)
board |
A pin board, created by |
name |
Pin name. |
version |
Retrieve a specific version of a pin. Use |
... |
Other arguments passed to |
file |
A path to write the Plumber file. Defaults to |
rsconnect |
Create a Plumber file with features needed for Posit Connect? Defaults to |
additional_pkgs |
Any additional R packages that need to be attached
via |
By default, this function will find and use the latest version of your
vetiver model; the model API (when deployed) will be linked to that specific
version. You can override this default behavior by choosing a specific
version
.
The content of the plumber.R
file, invisibly.
library(pins)
tmp <- tempfile()
b <- board_temp(versioned = TRUE)
cars_lm <- lm(mpg ~ ., data = mtcars)
v <- vetiver_model(cars_lm, "cars_linear")
vetiver_pin_write(b, v)
vetiver_write_plumber(b, "cars_linear", file = tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.