7.1.1 Preserve the origin story of package data

  • Make a data-creating script (e.g. to clean up raw data from elsewhere and get it ready to be included in the package)
  • Keep in data-raw/ as a .R file.
  • List data-raw/ in .Rbuildignore
  • A typical script in data-raw/ includes code to prepare a dataset and ends with a call to use_data()

To do this:

usethis::use_data_raw() # creates `data_raw/` folder and lists it in `.Rbuildignore`
usethis::use_data_raw("my_pkg_data") #??