tags:

views:

60

answers:

1

I'm creating an R package and I need it to include a couple of non R script files which get called by one of my functions. I need these script files to be distributed with the package, naturally. So that leaves me with two questions:

  1. a) In which directory of the package tree should I place these files? b) Is that location mandatory or just custom?
  2. Do I need to change any other settings or configurations or will they just get copied to the directory mentioned in #1 and then I can figure out the path using system.file()?

I've tried to find the answer in the Writing R Extensions document, but it didn't jump out at me. And, of course, I didn't read the whole thing. Am I being too honest here?

+5  A: 

I think you want either exec/ at the top-level (even though that is labeled 'still experimental, or subdirectory of inst as everything in inst/ gets copied verbatim into the package.

A quick example from the packages I have expanded in source is gdata which has inst/perl, inst/xls and inst/bin. These you could then call from R itself by computing the path of the installed package using system.file().

Dirk Eddelbuettel
Bingo! And now that I know what I am looking for, it's covered in the very fine documentation right here: http://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories
JD Long
inst/ is going to be what I use, I believe. I just want a payload carried over unmolested and un-executed.
JD Long
That'll do. I hope you also implement the `withLasers=TRUE` option for Shane while you're at it.
Dirk Eddelbuettel
I default `withLaster=T` and `withFrigginLasers=F`. I could be convinced to change the defaults if plied with enough beer.
JD Long