Get the list of installed packages by user in R

RPackages

R Problem Overview


How we can get the list of installed packages by user in R along with its version?

I know about the command installed.packages() which will give information about all packages (base or non-base). But how we can get those installed by user to have something like this:

Package    Version
X          3.01
Y          2.0.1
Z          1.0.2

For all user installed packages (i.e. those package you installed via install.packages("X"))

R Solutions


Solution 1 - R

ref

ip = as.data.frame(installed.packages()[,c(1,3:4)])
ip = ip[is.na(ip$Priority),1:2,drop=FALSE]
ip

Solution 2 - R

I just found another ways to see the list of the packages without writing any code:

  • Open RStudio
  • Navigate to Help --> R Help (from the menu above)
  • You will see the help panel opened.
  • Then follow, Reference --> Packages

There you are.


OR

  • Open R console
  • Navigate to Help --> Html help
  • Then follow, Reference --> Packages

Solution 3 - R

str(allPackage <- installed.packages(.Library, priority = "high"))

allPackage [, c(1,3:5)]

You will get all the active package List

Solution 4 - R

Here's my solution.

tibble::tibble(
  Package = names(installed.packages()[,3]),
  Version = unname(installed.packages()[,3])
)

You can even filter some packages that you want to show.

pkg = tibble::tibble(
  Package = names(installed.packages()[,3]),
  Version = unname(installed.packages()[,3])
)

dplyr::filter(pkg, Package %in% c("tibble", "dplyr"))

Solution 5 - R

If I develop an app or model and want to record the package versions used, I call sessionInfo()

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Question989View Question on Stackoverflow
Solution 1 - RTomView Answer on Stackoverflow
Solution 2 - R989View Answer on Stackoverflow
Solution 3 - RC k khamariView Answer on Stackoverflow
Solution 4 - Rhc_hahaView Answer on Stackoverflow
Solution 5 - RSeanosapienView Answer on Stackoverflow