rr-usethis

R package not running preprocessing scripts in data-raw


After reading this and this, I thought that R scripts in data-raw are executed on the package build and data are moved to the data folder for lazyloading. But it's not working in this test package. What am I doing wrong here?

devtools::install_github("sjkiss/ces")
library(ces)
data('df')

I am getting R CMD check succeeded and I don't get any warnings after installing the package.


Solution

  • Those scripts are not run automatically. The articles you point to just suggest you put the scripts there so you don't loose them and it's clear what they do. You need to run them yourself. They will not be run for you when you install packages.

    For example at this link they have a section named "How do I put my data in the package" and step #4 instructs you to run or source the script manually. In R Pacakages 7.1.1 it's a bit less explicit but again it's just a suggestion of where to put the script. There's nothing magic that happens when you put the files there.