# Create a temporary directory
temp_dir <- tempdir()
data_path <- file.path(temp_dir, "boilerplate_save_example", "data")
# Create a test database
test_db <- list(
methods = list(
sample = list(default = "Sample text")
),
measures = list(
test_measure = list(name = "Test", description = "A test measure")
)
)
# Save as unified database
boilerplate_save(
db = test_db,
data_path = data_path,
create_dirs = TRUE,
confirm = FALSE,
quiet = TRUE
)
# Check that file was created
file.exists(file.path(data_path, "boilerplate_unified.rds"))
# Save a single category
boilerplate_save(
db = test_db$methods,
category = "methods",
data_path = data_path,
confirm = FALSE,
quiet = TRUE
)
# Clean up
unlink(file.path(temp_dir, "boilerplate_save_example"), recursive = TRUE)
Run the code above in your browser using DataLab