Skip to contents

The execute phase runs the paper's code in the repository as the authors organised it (.repro_package_plan(): every file at its own path), but the module has only the plan (file → target_path) and the current on-disk location of each source file (data_check's structure). This builds the tree the plan describes inside a fresh temp directory: for each planned file with a real target and an available source copy, the source is copied to <root>/<target_path>. Nothing outside root is written, and root is the caller's to delete.

Usage

repro_materialize_layout(plan, structure_df, root)

Arguments

plan

the psychds_check table (file_name, target_path), or the package layout's plan (.repro_package_plan()), whose source column names each row's own file

structure_df

the data_check structure table (file_name, file_location)

root

the temp directory to build into (created if absent)

Value

root, invisibly, with attribute "materialised": a data frame of target_path / source / ok (whether the copy succeeded) rows.

Examples

src <- tempfile(fileext = ".csv")
writeLines(c("a,b", "1,2"), src)
plan <- data.frame(file_name = "x.csv", target_path = "data/x.csv")
structure_df <- data.frame(file_name = "x.csv", file_location = src)
root <- file.path(tempdir(), "layout_demo")
repro_materialize_layout(plan, structure_df, root)
list.files(root, recursive = TRUE)
#> [1] "data/x.csv"