Description Usage Arguments Value Note Author(s) Examples
Given a function, identify which package(s) it was
defined in. Most packages now have namespaces, so
functions can either be exported, or not. If your
function is exported in a namespace, then no problems. If
your function is not exported (usually hidden functions
starting with ‘.’, eg:
.gsea.get.classes.index.html
from metaGSEA
,
then there's no facility in native R to determine this
(AFAICT). By searching through a collection of source
code, you may find the file that contains the function,
and thus which package its from.
1 2 | which.package(func, unique = FALSE,
src.root = getOption("src.root"), verbose = FALSE)
|
func |
either the quoted function name (eg
“plot”), or the function's name (eg |
unique |
logical: if |
src.root |
the root folder containing all your R packages under development. |
verbose |
logical |
a vector of package names, 1 per function in func
If your function is hidden (ie, starts with a
dot), then you must use its quoted name when passing to
func=".my.hidden.function"
, otherwise doing this:
func=.my.hidden.function
, will cause the R
interpreter to complain that it can't find
.my.hidden.function
.
Mark Cowley
1 2 3 4 | ## Not run:
which.package(plot)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.