Learn R Programming

boilerplate (version 1.3.0)

boilerplate_list_files: List Available boilerplate Database Files

Description

Lists all boilerplate database files in a directory, organised by type (standard, timestamped, or backup).

Usage

boilerplate_list_files(data_path = NULL, pattern = NULL, category = NULL)

Value

A list with class "boilerplate_files" containing:

standard

Data frame of standard database files

timestamped

Data frame of timestamped versions

backups

Data frame of backup files

other

Data frame of other files that match the pattern

Each data frame contains columns: file, path, size, modified, format, base_name, timestamp, type, and category.

Arguments

data_path

Character. Path to the directory containing database files. If NULL (default), uses tools::R_user_dir("boilerplate", "data").

pattern

Character. Optional regex pattern to filter files.

category

Character. Optional category to filter results. Options include "measures", "methods", "results", "discussion", "appendix", "template", or "unified".

See Also

boilerplate_import for importing the listed files, boilerplate_restore_backup for restoring from backups.

Examples

Run this code
# \donttest{
# Create temporary directory for example
temp_dir <- tempfile()
dir.create(temp_dir)

# Initialise with some content
boilerplate_init(data_path = temp_dir, categories = "methods",
                 create_dirs = TRUE, confirm = FALSE, quiet = TRUE)

# Save with timestamp to create some files
db <- boilerplate_import(data_path = temp_dir, quiet = TRUE)
boilerplate_save(db, data_path = temp_dir, timestamp = TRUE,
                 confirm = FALSE, quiet = TRUE)

# List all database files
files <- boilerplate_list_files(data_path = temp_dir)
print(files)

# List only methods files
files <- boilerplate_list_files(data_path = temp_dir, category = "methods")

# List files matching a pattern
files <- boilerplate_list_files(data_path = temp_dir, pattern = "202")

# Clean up
unlink(temp_dir, recursive = TRUE)
# }

Run the code above in your browser using DataLab