yearntolearn
yearntolearn

Reputation: 1074

Including a dataset in a R package

This question may seem pretty naive and I bag your patience.

I have saved extension.RData and documented it in extension.R. Both of them are saved in /data folder of the R package I am developing.

As I close RStuidio and reload the package, however, I cannot call the data until I execute one of the functions, devtools::document() or devtool::load_all(). Does this suggest that my dataset is not in memory of the package? How could I not to execute devtools every time I start working on the package?

Thank you very much.

Upvotes: 1

Views: 147

Answers (1)

echasnovski
echasnovski

Reputation: 1181

As I have understood, you just created files extension.RData, extension.R (with documentation) in your project directory. However, this is not enough for RStudio to be able to reach your data. You have to install the package by running devtools::install() or clicking 'Build & Reload' button on 'Build' tab of RStudio.

Edit: Putting extension.R into R folder solves the problem.

Upvotes: 2

Related Questions