existing_files {xfun} | R Documentation |
Find file paths that exist
Description
This is a shorthand of x[file.exists(x)]
, and optionally returns the
first existing file path.
Usage
existing_files(x, first = FALSE, error = TRUE)
Arguments
x |
A vector of file paths. |
first |
Whether to return the first existing path. If |
error |
Whether to throw an error when |
Value
A vector of existing file paths.
Examples
xfun::existing_files(c("foo.txt", system.file("DESCRIPTION", package = "xfun")))
[Package xfun version 0.46 Index]