Find path to package files



Is there a function that I can use to find the location of a package within the filesystem? Something like:

#> /Library/Frameworks/R.framework/Versions/3.4/Resources/library/dplyr

I've taken a look at .libPaths() and various bits and pieces used in package loading (like getExportedValue and getNamespace), but I've come a little stuck.

Does anyone have any sage advise, helpful pointers, or useful blog posts lying around?


Found it:

getNamespaceInfo("dplyr", "path")


There is also ?system.file that probably does what you want. I usually look for DESCRIPTION of the package in question.


Ah yeah this looks even better


To find the package path on the system, you have also the find.package function