Skip to contents

When a script reads a file that is not present, the reason matters: a file deliberately withheld because it was too large to download is a different finding from a file simply absent from the repository. This cross-references the referenced basenames against the file plan and the download-skip records download_repo_files() attaches, and classifies each unresolved reference.

Usage

repro_missing_inputs(refs, plan, structure_df, skipped = NULL)

Arguments

refs

a character vector of referenced file basenames (unresolved reads)

plan

the psychds_check table (file_name + target_path)

structure_df

the data_check structure table (file_name + file_location + file_size)

skipped

optional data frame of size-skipped files (the oversize_skipped / gated attributes of download_repo_files(), with a file_name column)

Value

a data frame with basename, status (one of in_repo_not_downloaded, withheld_size, in_archive (the file is in the repository only inside a .zip or .tar, so the code cannot read it as the package is), absent), detail (a human-readable reason), and similar_to (a candidate near-match basename from the repository's file list, or NA — only ever set for absent rows; see below).

Examples

skipped <- data.frame(file_name = "big.csv", file_size = 200 * 1024 * 1024)
repro_missing_inputs(c("missing.csv", "big.csv"), plan = NULL,
                     structure_df = NULL, skipped = skipped)
#>      basename        status
#> 1 missing.csv        absent
#> 2     big.csv withheld_size
#>                                                                                    detail
#> 1                                        referenced file is not present in the repository
#> 2 referenced file is in the repository but was not downloaded (200 MB): over the size cap
#>   similar_to
#> 1       <NA>
#> 2       <NA>