Pin model data to provided pin board.

pin_model_data(
  board,
  data,
  model_input,
  model_plot,
  name,
  title = NULL,
  description = NULL,
  ...
)

Arguments

board

a board created with model_pin_board

data

data to pin

name

the name assigned to this data on blob, if wanting to add a new version of a previous result, re-use the name

title

title for data

...

additional named arguments passed is as metadata to the pin

Examples

if (FALSE) { # \dontrun{

# first create a board connected to the azure account you with to use
model_board <- model_pin_board("storage-account-name", "model-results")

# next run a model
bt_spas_x_results <- run_single_bt_spas_x(SRJPEmodel::bt_spas_x_bayes_params,
  bt_spas_x_input_data = SRJPEdata::weekly_juvenile_abundance_model_data,
  site = "ubc",
  run_year = 2004,
  lifestage = "fry",
  effort_adjust = F,
  bugs_directory = here::here("data-raw", "WinBUGS14"),
  debug_mode = FALSE, no_cut = T
)

# now pin the model
pin_model_data(
  model_board,
  bt_spas_x_results,
  name = "BT Spas at Butte",
  title = "bt spas results",
  description = "model results dataframe and model object"
)

# run again
bt_spas_x_results <- run_single_bt_spas_x(...)

# pin with same name to create a new version of the data, all previous versions are stored
pin_model_data(
  model_board,
  bt_spas_x_results,
  name = "BT Spas at Butte",
  title = "bt spas results",
  description = "model results dataframe and model object"
)

# or assign it a new name to create a new object on the board
pin_model_data(
  model_board,
  bt_spas_x_results,
  name = "BT Spas at Butte V2",
  title = "bt spas results",
  description = "model results dataframe and model object"
)

# search storeage for pins
model_board |> pins::pin_search()

# A tibble: 3 × 6
#   name                 type  title                created               file_size meta
#   <chr>                <chr> <chr>                <dttm>              <fs::bytes> <list>
# 1 full_model_object    rds   Model with new value 2024-07-31 14:02:13       2.42M <pins_met>
# 2 full_model_object_V2 rds   Model with new value 2024-07-31 14:26:42       2.42M <pins_met>
# 3 some numbers         rds   some numbers         2024-07-31 14:23:15          61 <pins_met>

# retrieve a pin
model_data <- pins::pin_read(model_board, "full_model_object")
} # }