pathological (version 0.1-1)

system_file: Find a file in a package

Description

Wrapper to system.file that returns standardized paths.

Usage

system_file(..., package = "base", library_location = NULL, must_work = FALSE, sep = c("/", "\\"))

Arguments

...
Character vectors specifying subdirectories and files within some package. The default, none, returns the root of the package. Wildcards are not supported.
package
A string with the name of a single package. An error occurs if more than one package name is given.
library_location
a character vector with path names of R libraries. See the 'Details section of system.file for the meaning of the default value of NULL.
must_work
If TRUE, an error is given if there are no matching files.
sep
String separator between directory levels in the output.

Value

A character vector of positive length, containing the file paths that matched ..., or a missing string, NA, if none matched (unless mustWork = TRUE). (This behaviour for missing paths differs from system.file.) 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

system.file

Examples

Run this code
# Examples taken from ?system.file
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")

Run the code above in your browser using DataLab