## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment  = "#>",
  eval     = FALSE
)


## -----------------------------------------------------------------------------
library(inlabru)
library(inlaops)
library(vetiver)
library(pins)

set.seed(1)
dat <- data.frame(x1 = rnorm(200), x2 = rnorm(200))
dat$y <- 2 + 0.8 * dat$x1 - 0.4 * dat$x2 + rnorm(200, sd = 0.5)

fit <- bru(
  y ~ Intercept(1) + x1 + x2,
  family  = "gaussian",
  data    = dat,
  options = bru_options(control.compute = list(config = TRUE))
)

v <- vetiver_model(
  fit, "inla_poc",
  metadata = list(pred_formula = "~ Intercept + x1 + x2")
)

board <- board_connect()
vetiver_pin_write(board, v)

