system_file: Find a file in a package

Description Usage Arguments Value See Also Examples

View source: R/wrappers.R

Description

Wrapper to system.file that returns standardized paths.

Usage

1
2
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

1
2
3
4
5
# 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")

richierocks/pathological documentation built on May 27, 2019, 8:47 a.m.