This help topic is for R version 1.5.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/file.access.html
file.access {base}R Documentation

Ascertain File Accessibility

Description

Utility function to access information about files on the user's file systems.

Usage

file.access(names, mode = 0)

Arguments

names

character vector containing file names.

mode

integer specifying access mode required.

Details

The mode value can be the exclusive or of the following values

0

test for existence.

1

test for execute permission.

2

test for write permission.

4

test for read permission.

Permission will be computed for real user ID and real group ID (rather than the effective IDs).

Value

An integer vector with values 0 for success and -1 for failure.

Note

This is intended as a replacement for the S-PLUS function access, a wrapper for the C function of the same name, which explains the return value encoding. Note that the return value is false for success.

Author(s)

B. D. Ripley

See Also

file.info

Examples

fa <- file.access(dir("."))
table(fa) # count successes & failures

[Package base version 1.5.0 ]