| systemFile {svMisc} | R Documentation |
Get system files or directories, in R subdirectories, in package subdirectories, or elsewhere on the disk (including executables that are accessible on the search path).
systemFile(..., exec = FALSE, package = NULL, lib.loc = NULL) systemDir(..., exec = FALSE, package = NULL, lib.loc = NULL)
... |
one or several executables if |
exec |
if |
package |
the name of one package to look for files or subdirs in its
main directory (use |
lib.loc |
a character vector with path names of R libraries or
|
A string with the path to the directories or files, or "" if they are
not found, or of the wrong type (a dir for systemFile() or or a file
for systemDir()).
These function aggregate the features of several R functions in package
base: system.file(), R.home(), tempdir(), Sys.which(), and aim to provide a
unified and convenient single interface to all of them. We make sure also to
check that returned components are respectively directories and files for
systemDir() and systemFile().
Philippe Grosjean <phgrosjean@sciviews.org>
fileEdit, file.path, file.exists
systemFile("INDEX", package = "base")
systemFile("help", "AnIndex", package = "splines")
systemFile(package = "base") # This is a dir, not a file!
systemFile("zip", exec = TRUE)
systemFile("ftp", "ping", "zip", "nonexistingexe", exec = TRUE)
systemDir("temp") # The R temporary directory
systemDir("sysTemp") # The system temporary directory
systemDir("user") # The user directory
systemDir("home", "bin", "doc", "etc", "share") # Various R dirs
systemDir("zip", exec = TRUE) # Look for the dir of an executable
systemDir("ftp", "ping", "zip", "nonexistingexe", exec = TRUE)
systemDir(package = "base") # The root of the 'base' package
systemDir(package = "stats") # The root of package 'stats'
systemDir("INDEX", package = "stats") # This is a file, not a dir!
systemDir("help", package = "splines")