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)

Arguments

x

A vector of file paths.

first

Whether to return the first existing path. If TRUE and no specified files exist, it will signal an error.

Value

A vector of existing file paths.

Examples

xfun::existing_files(c("foo.txt", system.file("DESCRIPTION", package = "xfun")))

[Package xfun version 0.29 Index]