Adding a dataset to a package

Packages are also used to deliver research and research results to people and make them reproducible. Therefore, it is often necessary to include a dataset in our R package. Many packages also use this possibility to include this data into their demo code, to give users the possibilities to execute a demo version of the package's functions instantly without the need to import your own data.

To include this data, R provides several options. The choice of the option depends on what kind of data we want to attach to the package and what this data will be used for.

The most common way is to include it in the data subdirectory. This way is often used when our dataset is used for the example code. Another way to include it ...

Get Mastering RStudio – Develop, Communicate, and Collaborate with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.