Get the list of installed packages by user in R

孤者浪人 提交于 2019-12-04 07:46:28

问题


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"))


回答1:


ref

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



回答2:


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



回答3:


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

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

You will get all the active package List




回答4:


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



来源:https://stackoverflow.com/questions/38481980/get-the-list-of-installed-packages-by-user-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!