# Create a temporary directory and initialise databases
temp_dir <- tempdir()
data_path <- file.path(temp_dir, "boilerplate_export_example", "data")
# Initialise and import databases
boilerplate_init(
categories = c("methods", "measures"),
data_path = data_path,
create_dirs = TRUE,
confirm = FALSE,
quiet = TRUE
)
unified_db <- boilerplate_import(data_path = data_path, quiet = TRUE)
# Export entire database
export_path <- file.path(temp_dir, "export")
boilerplate_export(
db = unified_db,
data_path = export_path,
create_dirs = TRUE,
confirm = FALSE,
quiet = TRUE
)
# Export selected elements
boilerplate_export(
db = unified_db,
select_elements = "methods.*",
output_file = "methods_only.rds",
data_path = export_path,
confirm = FALSE,
quiet = TRUE
)
# Clean up
unlink(file.path(temp_dir, "boilerplate_export_example"), recursive = TRUE)
Run the code above in your browser using DataLab