Reputation: 584
While developing a package I encountered the problem of supplementary data import - this has been 'kind of' solved here.
Nevertheless, I need to make use of a function of another package, which needs
a path to the used file. Sadly, using GlobalEnvironment variables here is not an option.
[By the way: the file needs to be .txt
, while supplementary data should be .RData
. The function is quite picky.]
So I need to know how to get the path supplementary data file of a package. Is this even possible to do?
I had the idea of reading the .RData
into the global environment and then saving it into a tmpfile
for further processing. I would really like to know a clean way - the supplementary data is ~100MB large...
Thank you very much!
Upvotes: 0
Views: 29
Reputation: 46866
Use system.file()
to reliably find the path to the installed package and sub-directories, typically these are created in your-pkg-source/inst/extdata/your-file.txt
and then referenced as
system.file(package="your-pkg", "extdata", "your-file.txt")
Upvotes: 1