checkFile {checkmate}R Documentation

Check existence and access rights of files

Description

Check existence and access rights of files

Usage

checkFile(x, access = "")

assertFile(x, access = "", .var.name)

testFile(x, access = "")

Arguments

x

[any]
Object to check.

access

[character(1)]
Single string containing possible characters ‘r’, ‘w’ and ‘x’ to force a check for read, write or execute access rights, respectively. Write and executable rights are not checked on Windows.

.var.name

[character(1)]
Name for x. Defaults to a heuristic to determine the name using deparse and substitute.

Value

Depending on the function prefix: If the check is successful, all functions return TRUE. If the check is not successful, assertFile throws an error message, testFile returns FALSE and checkFile returns a string with the error message.

See Also

Other filesystem: assertAccess, checkAccess, testAccess; assertDirectory, checkDirectory, testDirectory; assertPathForOutput, checkPathForOutput, testPathForOutput

Examples

# Check if R's COPYING file is readable
testFile(file.path(R.home(), "COPYING"), access = "r")

# Check if R's COPYING file is readable and writable
testFile(file.path(R.home(), "COPYING"), access = "rw")

[Package checkmate version 1.6.0 Index]