exampleFiles: Path to Files in the Examples Subdirectory

Description Usage Arguments Details Value See Also

View source: R/demoSource.R

Description

Given one or more file names, returns the corresponding paths to files in the "Examples" subdirectory of a package. With the names argument missing, returns the names of all such files.

Usage

1
exampleFiles(names = character(), where = "SoDA", oneFile = FALSE, path = TRUE)

Arguments

names

Either character string names or page numbers matched against the file names defined by the second argument. See details below.

where

The name of the package containing the "Examples" directory, by default, this package, or else the path name of a directory which itself contains the files of interest.

oneFile

If TRUE, and more than one file matches, the caller will be asked to select one of these files.

path

If TRUE, the file(s) will be returned with full directory paths; else, only with the file names.

Details

In any call, argument names can be a vector of character string names, expected to match files in the directory of examples. The names may match only the leading part of the file name; in particular, it will often be the case that the actual file name has a suffix such as ".R", omitted in the names argument.

If the argument where is a package name, then that package is expected to have a directory named "Examples", as does this package. In all other circumstances, this argument must itself be the path name of a directory containing the example files.

In the case of a package, if the package has a data frame object named examplePages, that object will be used to match page numbers of a document on which the examples appear. In the default case, the document is the book Software for Data Analysis. If you see an example in the book that appears to be the output from running some R code, enter the page number on which the output starts as the names argument. Often (though not always) the corresponding R code is one of the files in the Examples directory of the package. Some other files, such as source in other languages or related data, are also provided corresponding to examples.

Note that the same use of page numbers applies in calls to runExample or demoExample.

Value

Names for the matching files, or for all such files if names was missing.

See Also

runExample to run such files, and demoExample to run them as interactive demos.


SoDA documentation built on Oct. 28, 2020, 9:07 a.m.