Checks if all files exist (or if exists = FALSE do not exist as files or directories).
check_files(x, exists = TRUE, x_name = NULL)
Arguments
- x
The object to check.
- exists
A flag specifying whether the files/directories must (or must not) exist.
- x_name
A string of the name of object x or NULL.
Value
An informative error if the test fails or an invisible copy of x.
Examples
check_files(tempfile("unlikely-that-exists-chk"), exists = FALSE)
try(check_files(tempfile("unlikely-that-exists-chk")))
#> Error in eval(expr, envir) :
#> `tempfile("unlikely-that-exists-chk")` must specify existing files ('/tmp/RtmpnG4Dmq/unlikely-that-exists-chkbbb763fc7bee5' can't be found).