[Rd] An inconsistency in docs for file.access(base)

Keith Satterley 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:

Examples
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

 > sessionInfo()
R version 2.9.0 Under development (unstable) (2009-01-15 r47607)
i386-pc-mingw32

locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

loaded via a namespace (and not attached):
[1] tools_2.9.0

Same situation in R2.8.1


cheers,

Keith
========================
Keith Satterley
Bioinformatics Division
The Walter and Eliza Hall Institute of Medical Research
Parkville, Melbourne,
Victoria, Australia



More information about the R-devel mailing list