boilerplate_methods {boilerplate} | R Documentation |
Access Methods from Unified Database
Description
This function extracts and returns the methods portion of a unified database, optionally retrieving a specific method by name.
Usage
boilerplate_methods(unified_db, name = NULL)
Arguments
unified_db |
List. The unified boilerplate database |
name |
Character. Optional specific method to retrieve using dot notation |
Value
List or character. The requested methods database or specific method
Examples
# Create a temporary directory and initialise database
temp_dir <- tempdir()
data_path <- file.path(temp_dir, "boilerplate_methods_example", "data")
# Initialise with default methods content
boilerplate_init(
categories = "methods",
data_path = data_path,
create_dirs = TRUE,
create_empty = FALSE,
confirm = FALSE,
quiet = TRUE
)
# Import all databases
unified_db <- boilerplate_import(data_path = data_path, quiet = TRUE)
# Get all methods
methods_db <- boilerplate_methods(unified_db)
names(methods_db)
# Get a specific method using dot notation (if it exists)
if ("statistical" %in% names(methods_db) &&
"longitudinal" %in% names(methods_db$statistical) &&
"lmtp" %in% names(methods_db$statistical$longitudinal)) {
lmtp_method <- boilerplate_methods(unified_db, "statistical.longitudinal.lmtp")
}
# Clean up
unlink(file.path(temp_dir, "boilerplate_methods_example"), recursive = TRUE)
[Package boilerplate version 1.3.0 Index]