Does the input contain a file?

isFile(x)

isAFile(x, nullOK = FALSE)

allAreFiles(x)

Arguments

x

Object.

nullOK

logical(1). If set to TRUE, x may also be NULL.

Value

TRUE on success; FALSE on failure, with cause set.

Functions

  • isFile: Vectorized.

  • isAFile: Scalar.

  • allAreFiles: Scalar.

Note

Updated 2019-08-08.

See also

Examples

## TRUE ==== x <- "example.txt" file.create(x)
#> [1] TRUE
isAFile(x)
#> [1] TRUE
unlink(x) ## FALSE ==== isFile(c("~", "."))
#> [1] FALSE FALSE #> Cause: 2 failures #> pos value cause #> 1 1 ~ dir #> 2 2 . dir