Skip to contents

This function takes a vector of file paths as input and checks if each file exists. If a file does not exist, the function returns a message indicating which file(s) do(es) not exist.

Usage

sn_check_file(x, stop = TRUE)

Arguments

x

A vector of file paths.

stop

A logical value indicating whether to stop the function if a file does not exist. Default is TRUE.

Value

If stop is TRUE, the function stops and returns a message indicating which file(s) do(es) not exist. If stop is FALSE, the function returns a vector of file paths that do not exist.

See also

Examples

existing <- tempfile("existing-")
file.create(existing)
#> [1] TRUE
missing <- tempfile("missing-")
sn_check_file(c(existing, missing), stop = FALSE)
#> [1] "/tmp/Rtmp9uKaJP/missing-1e8e32564e15"