file_test(op, x, y)
op |
a character string specifying the operation of test style on files. The supported unary tests are:
| ||||||||||
x | a character string specifying the file or directory path. Required. | ||||||||||
y | a character string specifying the second file or directory path. Required for binary tests only. |
file_test("-f", .libPaths()[1]) # FALSE file_test("-f", file.path(.libPaths()[1], "stats", "DESCRIPTION")) # TRUE file_test("-d", .libPaths()[1]) # TRUE file_test("-x", .libPaths()[1]) # TRUE# Test if the modified time of package "utils" is older than "stats" file_test("-ot", file.path(.libPaths()[1], "utils"), file.path(.libPaths()[1], "stats"))
# Unsupported test causes a stop with message "test 'foo' is not available" file_test("foo", .libPaths()[1])