Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listing R Package Dependencies Without Installing Packages

Is there a simple way to get a list of R package dependencies (all recursive dependencies) for a given package, without installing the package and it's dependencies? Something similar to a fake install in portupgrade or apt.

like image 283
Jonathan Lisic Avatar asked Feb 01 '13 11:02

Jonathan Lisic


People also ask

Do I need to install R packages every time?

You only need to install packages the first time you use R (or after updating to a new version). **R Tip:** You can just type this into the command line of R to install each package. Once a package is installed, you don't have to install it again while using the version of R!

How do I list installed packages in R?

To see what packages are installed, use the installed. packages() command. This will return a matrix with a row for each package that has been installed.


1 Answers

You can use the result of the available.packages function. For example, to see what ggplot2 depends on :

pack <- available.packages() pack["ggplot2","Depends"] 

Which gives :

[1] "R (>= 2.14), stats, methods" 

Note that depending on what you want to achieve, you may need to check the Imports field, too.

like image 122
juba Avatar answered Oct 17 '22 09:10

juba