[Rd] An inconsistency in docs for file.access(base)
keith at wehi.EDU.AU
Mon Feb 16 07:40:27 CET 2009
I was chasing a "no permission to install to directory" error message. I was
looking in the code for /R/trunk/src/library/tools/R/install.R which pointed me
to the file.access function.
On reading the help for this function, it has the following in the Details section:
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.
It has the following under the Examples section:
fa <- file.access(dir("."))
table(fa) # count successes & failures
d <- dir(file.path(R.home(), "bin"))
df <- dir(file.path(R.home(), "bin"), full.names = TRUE)
d[file.access(df, 0) == 0] # all exist
d[file.access(df, 1) == 0] # some are executable, some are not
d[file.access(df, 2) == 0] # hopefully all are readable
d[file.access(df, 4) == 0] # they may or may not be writable
I presume mode = 2 is a test for writing, so could someone change the comments
around in the Examples
R version 2.9.0 Under development (unstable) (2009-01-15 r47607)
attached base packages:
 stats graphics grDevices datasets utils methods base
loaded via a namespace (and not attached):
Same situation in R2.8.1
The Walter and Eliza Hall Institute of Medical Research
More information about the R-devel