R/checks_for_functions.R

Defines functions check_manifest_files

Documented in check_manifest_files

#' Checks that the files defined in the manifest exist
#'
#' @importFrom purrr map
#' @importFrom rlang .data
#'
#' @param my_manifest A list with the contents of the manifest file.
#' @param file_dir Path to the directory where all the files have been extracted.
#'
check_manifest_files <- function(my_manifest, file_dir) {

    found <- my_manifest$location %>%
        map(~ paste0(file_dir, .data)) %>%
        map(file.exists) %>%
        unlist()

    if (!all(found)) {

        stop(paste("Files", my_manifest$location[!found], "defined in manifest but not found."))

    }

}

Try the FSK2R package in your browser

Any scripts or data that you put into this service are public.

FSK2R documentation built on March 18, 2022, 7:21 p.m.