List R Packages
list_r_packages.RdLists R packages either from an renv lockfile or from the current session. When using renv mode, it reads package information from a lockfile. When not using renv, it lists both loaded and base packages from the current session.
Value
Invisibly returns NULL. The function prints package information
as side effects:
If
use_renv = TRUE: Prints a data frame with Package, Version, and Title columns from the lockfile.If
use_renv = FALSE: Prints three data frames:Loaded packages (from
sessionInfo()$loadedOnly)Base packages (from
sessionInfo()$basePkgs)All packages combined
Details
When use_renv = TRUE, the function attempts to read the renv lockfile
from the specified path. If the file doesn't exist, a message is printed.
When use_renv = FALSE, the function retrieves package information from
the current R session, including both loaded packages (those loaded but
not attached) and base packages.