View source: R/list-packages.R
list_required_packages | R Documentation |
This function reports the names and currently installed versions of R packages used by all R scripts and R Markdown files in a given directory.
list_required_packages(path = ".", recursive = TRUE)
path |
A character vector of length one giving the directory you'd like searched for R scripts and R Markdown files |
recursive |
Should the function search for R scripts and R Markdown
files recursively? Default is |
This function looks at all R scripts and R Markdown files contained in a
directory (and its subdirectories if recursive
is TRUE
) and tries to
identify all packages used in those R scripts and R Markdown files. It looks
for names of packages in library()
and require()
calls, as well as
packages used in the form package::function()
or package:::function()
.
Detection of packages used may be imperfect, but it should work fairly well.
The function also records the versions of those packages currently installed, as well as the R version being used, and if RStudio is installed, the RStudio version installed, and reports that information as well.
An object of class RequiredPackages
, which is a list of length
three, with elements
A character vector of length one giving the R version
A character vector of length one giving the RStudio version, if applicable, or NA if not.
A character matrix with two columns, "Package", giving the names of the packages detected, and "Version", giving the version currently installed.
print.RequiredPackages()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.