How do you determine which packages depend on a given package in R?

I have a package in my library and I don't know where it comes from. Presumably it was downloaded as a dependency of another package I am using. How can I know which package depends on the package of interests?

+3


source to share


1 answer


You can use installed.packages

which provides a list of all packages you have installed with their dependencies (as a matrix object). Let's say for example that you want to find which packages depend 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"

      

+4


source







All Articles