I need some clarification about usage of datasets within a package. I want to export dataset but also use it internally within a package function. Exporting dataset works, but when I try to use it within a function with:
My go-to whenever I need to add data to a package is the chapter Data from R Packages. However, it makes a clear distinction between external and internal data sets; whereas, you want to use the data for both use cases. I recommend reading through it for ideas.
Off the top of my head, one idea would be to put the data set in inst/. Then you could load the data inside your package functions with system.file(), and you could provide the end users with a convenience function to load this data. This would lose some of the convenience of using the built-in system via utils::data(), but it would give you more flexibility as the package author.
Thanks for feedback. I always look into book whenever I have pacakge development related questions. It's really great and I love search option. I've read that chapter but didnt manage to find something regarding using dataset internally and exporting it at same time.
I'm interesed in 'good practice' solution, and your suggestions seems to be one.