File: existing_files.Rd

package info (click to toggle)
r-cran-xfun 0.37%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 792 kB
  • sloc: ansic: 242; sh: 22; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 858 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\name{existing_files}
\alias{existing_files}
\title{Find file paths that exist}
\usage{
existing_files(x, first = FALSE, error = TRUE)
}
\arguments{
\item{x}{A vector of file paths.}

\item{first}{Whether to return the first existing path. If \code{TRUE} and no
specified files exist, it will signal an error unless the argument
\code{error = FALSE}.}

\item{error}{Whether to throw an error when \code{first = TRUE} but no files
exist. It can also take a character value, which will be used as the error
message.}
}
\value{
A vector of existing file paths.
}
\description{
This is a shorthand of \code{x[file.exists(x)]}, and optionally returns the
first existing file path.
}
\examples{
xfun::existing_files(c("foo.txt", system.file("DESCRIPTION", package = "xfun")))
}