datafolder_check: Check local data folder is up-to-date

Description Usage Arguments Details Value See Also

View source: R/funcs.R

Description

We don't want to sync the actual data to git remotes. Instead, we list the files expected in the data/ subfolder in docs/data_folder_content.csv with their md5 checksums. This .csv should be synced to git, and this function run when git pulling, to see if the actual data folder needs updating. This function compares docs/data_folder_content.csv to the actual contents in data/, and outputs an error or warning if things are not matching, with a list of mismatches.

Usage

1
2
datafolder_check(stop_on_error = TRUE, docs_folder = "docs",
  data_folder = "data")

Arguments

stop_on_error

if TRUE (default), stops execution with an error message when a file is listed in data_folder_content.csv but doesn't match the contents of the data folder. If set to FALSE, instead outputs a warning and continues execution of the code.

docs_folder

subfolder where the data_folder_content.csv file is located. Currently cannot be the working directory root.

data_folder

data folder path

Details

The md5 checksum is created using openssl::md5(file(<filename>))

Generating or updating docs/data_folder_content.csv is done using datafolder_update

Value

If no mismatches has been found, returns nothing. If a mismatch is found an error or warning is raised, with a message listing the files which are missing, changed, renamed, or are new in the data folder and not yet recorded. If the number of files to list is >15 a temp file is opened with this information instead of printing it to console

See Also

datafolder_update


bosefalk/datafolder documentation built on Sept. 11, 2019, 3:52 p.m.