View source: R/listPackageFunctions.R
listPackageFunctions | R Documentation |
This function extracts the list of functions contained within a specified R package and retrieves a brief description for each function from the package documentation. The description is obtained by parsing the Rd file associated with each function to extract the text from the \title
field. In addition, the function determines whether each function is exported from the package by comparing against the package’s exported names.
listPackageFunctions(pkg)
pkg |
A character string or an unquoted name specifying the package from which to extract functions. The package must be installed and accessible. |
The function first accesses the package namespace using asNamespace
and retrieves all objects using ls
. It filters these objects to include only functions. For each function, the associated help file is retrieved using utils::help
and the Rd file is extracted with utils:::.getHelpFile
. The internal helper function getRdTitle
is then used to parse the Rd object and extract the text in the \title
field. Finally, the function assembles the output into a data frame that also includes an indicator of whether each function is exported.
A data frame with three columns. The Function
column lists the names of the functions found in the package. The Description
column contains the brief descriptions extracted from each function’s documentation, and the Exported
column is a logical vector indicating whether the function is exported from the package.
## Not run:
# Extract functions from the stats package along with their descriptions and export status.
tab <- listPackageFunctions("stats")
print(tab)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.