system.file {base}R Documentation

Find Names of R System Files

Description

Finds the full file names of files in packages etc.

Usage

system.file(..., package = "base", lib.loc = NULL)

Arguments

... character vectors, specifying subdirectory and file(s) within some package. The default, none, returns the root of the package. Wildcards are not supported.
package a character string with the name of a single package. An error occurs if more than one package name is given.
lib.loc a character vector with path names of R libraries, or NULL. The default value of NULL corresponds to all libraries currently known. If the default is used, the loaded packages are searched before the libraries.

Details

This checks the existence of the specified files with file.exists. So file paths are only returned if there are sufficient permissions to establish their existence.

The unnamed arguments in ... are usually character strings, but if character vectors they are recycled to the same length.

Value

A character vector of positive length, containing the file paths that matched ..., or the empty string, "", if none matched.

If matching the root of a package, there is no trailing separator.

system.file() with no arguments gives the root of the base package.

See Also

R.home for the root directory of the R installation, list.files.

Sys.glob to find paths via wildcards.

Examples

system.file()                  # The root of the 'base' package
system.file(package = "stats") # The root of package 'stats'
system.file("INDEX")
system.file("help", "AnIndex", package = "splines")

[Package base version 2.12.2 Index]