Retrieve path of supplementary data file of developed package

40 Views Asked by At

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!

1

There are 1 best solutions below

2
On BEST ANSWER

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")