Re: [Rd] Referencing 'inst' directory in installed package

From: Marc Schwartz <>
Date: Wed, 17 Aug 2011 07:35:41 -0500

On Aug 16, 2011, at 10:17 PM, Jonathan Malmaud wrote:

> Hi,
> My R package has files in the 'inst' directory that it needs to reference. How can the R scripts in my package find out the full path to the 'inst' directory after the package is installed, given that different users may have installed the package to different libraries?
> Thanks,
> Jon Malmaud

See ?path.package and ?file.path


> require(WriteXLS)

Loading required package: WriteXLS

# I am on OSX
> path.package("WriteXLS")

[1] "/Library/Frameworks/R.framework/Versions/2.13/Resources/library/WriteXLS"

I have Perl scripts in my package, which are in the /inst/Perl folder in the package source, so:

> file.path(path.package("WriteXLS"), "Perl/")
[1] "/Library/Frameworks/R.framework/Versions/2.13/Resources/library/WriteXLS/Perl/"

HTH, Marc Schwartz mailing list Received on Wed 17 Aug 2011 - 12:53:54 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 17 Aug 2011 - 14:00:19 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive