
Copy a paper's files into a throwaway directory, as a plan places them
Source:R/reproducibility_check.R
repro_materialize_layout.RdThe 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.
Arguments
- plan
the
psychds_checktable (file_name,target_path), or the package layout's plan (.repro_package_plan()), whosesourcecolumn names each row's own file- structure_df
the
data_checkstructure 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"