| checkFile {checkmate} | R Documentation |
Check existence and access rights of files
checkFile(x, access = "") assertFile(x, access = "", .var.name) testFile(x, access = "")
x |
[any] |
access |
[ |
.var.name |
[character(1)] |
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.
Other filesystem: assertAccess,
checkAccess, testAccess;
assertDirectory,
checkDirectory,
testDirectory;
assertPathForOutput,
checkPathForOutput,
testPathForOutput
# 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")