How do I determine what packages are dependent on a given package in R?

You can use installed.packages which gives the list of all your installed packages with their dependencies (as a matrix object). Say for instance that you want to find which packages are dependent on rJava:

#get my installed packages
x<-installed.packages()
#find packages dependent on rJava
x[grepl("rJava",x[,"Depends"]),"Package"]
#the result for my R installation
#  XLConnect        xlsx    xlsxjars 
#"XLConnect"      "xlsx"  "xlsxjars"

If you want to find packages dependent on rJava, just use tools package.

library(tools)
dependsOnPkgs("rJava")

Tags:

R