In the documentation, R suggests that raw data files (not Rdata nor Rda) should be placed in inst/extdata/
From the first paragraph in: http://cran.r-pr
You were both very close and essentially had this. A formal reference from 'Writing R Extensions' is:
1.1.3 Package subdirectories
[...]
The contents of the
inst
subdirectory will be copied recursively to the installation directory. Subdirectories ofinst
should not interfere with those used by R (currently,R
,data
,demo
,exec
,libs
,man
,help
,html
andMeta
, and earlier versions usedlatex
,R-ex
). The copying of theinst
happens aftersrc
is built so itsMakefile
can create files to be installed. Prior to R 2.12.2, the files were installed on POSIX platforms with the permissions in the package sources, so care should be taken to ensure these are not too restrictive:R CMD build
will make suitable adjustments. To exclude files from being installed, one can specify a list of exclude patterns in file.Rinstignore
in the top-level source directory. These patterns should be Perl-like regular expressions (see the help forregexp
in R for the precise details), one per line, to be matched(10) against the file and directory paths, e.g.doc/.*[.]png$
will exclude all PNG files ininst/doc
based on the (lower-case) extension.
More useful than using file.path
would be to use system.file
. Once your package is installed, you can grab your file like so:
fpath <- system.file("extdata", "my_raw_data.csv", package="my_package")
fpath
will now have the absolute path on your HD to the file.