Directory of a package
package.dir.Rd
Display a partial or complete directory of a package. By default, suppress common package contents to focus on 'demo', 'doc', 'scripts', and similar subdirectories whose contents might contain examples that could make it easier to learn capabilities of the package.
Usage
package.dir(package = 'base', lib.loc = NULL,
exclude = c('chtml', 'data', 'help', 'html', 'latex', 'libs',
'man', 'Meta', 'po', 'R', 'R-ex', 'src'),
include = NULL, pattern = NULL, recursive = FALSE)
Arguments
- package
character string naming a locally installed package. If 'package' is not locally installed, it is an error.
- 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.
- exclude
either NULL or a character vector naming subdirectories of 'package' to exclude from the list. If 'include' is not NULL, 'exclude' is ignored.
- include
either NULL or a character vector naming subdirectories of 'package' to exclude from the list. If 'include' is not NULL, 'exclude is ignored.
- pattern
an optional regular expression passed with the results of system.file to dir. Only file names which match the regular expression will be returned. This is ignored if 'recursive' is FALSE.
- recursive
logical. Should the listing recurse into subdirectories?
Details
1. fullPath <- system.file(package = package, lib.loc = lib.loc)
2. Dir <- dir(fullPath)
3. Restrict Dir only to 'include' if provided and to all but 'exclude' otherwise.
4. If recursive, return a list produced by dir
for each
of the subdirectories of interest determined in step 3. Else, return
only the list of subdirectories from step 3.
Value
If recursive, a list of the contents of the subdirectories of interest. Else, a character vector of the names of the relevant subdirectories.