I am currently developing an R package and want it to be as clean as possible, so I try to resolve all WARNINGs and NOTEs displayed by devtools::check()
.
One of these notes is related to some code I use for generating sample data to go with the package:
checking top-level files ... NOTE
Non-standard file/directory found at top level:
'generate_sample_data.R'
It's an R script currently placed in the package root directory and not meant to be distributed with the package (because it doesn't really seem useful to include)
So here's my question:
Where should I put such a file or how do I tell R to leave it be?
Is .Rbuildignore
the right way to go?
Currently devtools::build()
puts the R script in the final package, so I shouldn't just ignore the NOTE.
As suggested in http://r-pkgs.had.co.nz/data.html, it makes sense to use ./data-raw/
for scripts/functions that are necessary for creating/updating data but not something you need in the package itself. After adding ./data-raw/
to ./.Rbuildignore
, the package generation should ignore anything within that directory. (And, as you commented, there is a helper-function devtools::use_data_raw()
.)