is_file: Check file paths and directories

Description Usage Arguments Value Examples

View source: R/predicates.R

Description

These functions check whether the directories or files exist and whether the current user has read or write permissions. If a character vector is supplied each element is checked, returning a logical vector of the same length.

Usage

1
2
3
4
5
6
7
8
9

Arguments

x

(any) The object to test

Value

TRUE if x is a path to an existing directory, FALSE otherwise

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
is_dir(tempdir())
is_dir("/does/not/exist")

tmpfile <- tempfile()
file.create(tmpfile)

is_file(tmpfile)
is_file("/does/not/exist.txt")

is_readable(tmpfile)
is_readable("/does/not/exist.txt")

is_writeable(tmpfile)
is_writeable("/does/not/exist.txt")

is_url("http://something.com")
is_url("https://google.com")
is_url(c("http://something.com", "https://google.com"))

is_url(1)
is_url("foo")
is_url(NA)

ChadGoymer/msgr documentation built on April 10, 2021, 10:31 a.m.