Given module configuration files, datasets, etc. this will construct a preload directory generally used for testing purposes.
Usage
mk_preload_dir(
directory = tempfile(pattern = "preload_"),
preload = NULL,
rpt_templates = c(system.file(package = "onbrand", "templates", "report.docx"),
system.file(package = "onbrand", "templates", "report.pptx"), system.file(package =
"onbrand", "templates", "report.docx")),
mod_yaml = c(system.file(package = "formods", "templates", "formods.yaml"),
system.file(package = "formods", "templates", "ASM.yaml"), system.file(package =
"formods", "templates", "UD.yaml"), system.file(package = "formods", "templates",
"DM.yaml"), system.file(package = "formods", "templates", "DW.yaml"),
system.file(package = "formods", "templates", "FG.yaml")),
include = NULL
)Arguments
- directory
Target directory to contain the preload file structure.
- preload
One or more preload yaml files to include. Multiple files will be combined into a single preload.yaml file.
- rpt_templates
Vector containing PowerPoint, Word and the onbrand yaml mapping file.
- mod_yaml
Vector of module yaml files to include
- include
List of files to include each element of the list should include a 'from' option with the abosolute path to the source file and a 'to' with the name of the file in the preload directory. If you want to place the in a subdirectory of the preload directory include the optional path option. (e.g.
list(UD = list(from="/full/path/to/source/file.csv", path="data/stuff", to="newfile.csv")))
Value
List with the following elements:
isgood: Return status of the function.
msgs: Error or warning messages if any issues were encountered.
Examples
pldir = file.path(tempdir(), "preload_test")
mpd_res = mk_preload_dir(
directory = pldir,
preload = c(system.file(package="formods", "preload", "ASM_preload.yaml"),
system.file(package="formods", "preload", "UD_preload.yaml")),
mod_yaml = c(
system.file(package="formods", "templates", "formods.yaml"),
system.file(package="formods", "templates", "ASM.yaml"),
system.file(package="formods", "templates", "UD.yaml"),
system.file(package="formods", "templates", "DM.yaml"),
system.file(package="formods", "templates", "DW.yaml"),
system.file(package="formods", "templates", "FG.yaml")),
)
dir(pldir)
#> [1] "config" "preload.yaml" "reports"
