Returns character vector (or list of character vectors) of the absolute paths to all models stored in the based_on field of a bbi_... object.

get_based_on(.bbi_object, .check_exists = FALSE)

# S3 method for default
get_based_on(.bbi_object, .check_exists = FALSE)

# S3 method for character
get_based_on(.bbi_object, .check_exists = FALSE)

# S3 method for bbi_run_log_df
get_based_on(.bbi_object, .check_exists = FALSE)

get_model_ancestry(.bbi_object)

# S3 method for default
get_model_ancestry(.bbi_object)

# S3 method for character
get_model_ancestry(.bbi_object)

# S3 method for bbi_run_log_df
get_model_ancestry(.bbi_object)

Arguments

.bbi_object

The model object to query. Could be a bbi_{.model_type}_model object, a file path to a model, a tibble of class bbi_run_log_df, or some other custom object containing model data.

.check_exists

If FALSE, the default, function will return all paths in based_on regardless of whether they point to an existing file. If TRUE, function will check if a file exists at each path in based_on and error if one does not.

Details

get_model_ancestry() extracts paths to all models that this model is based on (iterating over get_based_on() function), and all models that those models are based on, recursively. It returns a sorted unique character vector for the default and character method, and a list of such vectors for the bbi_run_log_df method. Some notes on get_model_ancestry():

  • .check_exists = TRUE is set for this iterative search because each model found will subsequently be loaded.

  • get_model_ancestry() has all the same S3 methods as get_based_on()

For both get_based_on() and get_model_ancestry(), all paths saved in the object or accompanying YAML will be relative to the location of that YAML When the object is loaded into memory, the absolute path to the YAML is stored in the object. These functions simply stitch together that path with the relative paths from the based_on field. As long as the YAML has not moved since it was read into memory, these paths will be both absolute and correct.

Methods (by class)

  • get_based_on(default): The default method attempts to extract the path from any object passed to it, but is designed for a list of class bbi_{.model_type}_model or something similar.

  • get_based_on(character): Takes a character scalar of a path to a model that can be loaded with read_model(.bbi_object).

  • get_based_on(bbi_run_log_df): Takes a tibble of class bbi_run_log_df and returns a list containing one character vector of paths for each row of the tibble.