use_data() makes it easy to save package data in the correct format. I recommend you save scripts that generate package data in data-raw: use use_data_raw() to set it up.

use_data(..., internal = FALSE, overwrite = FALSE,
compress = "bzip2")

use_data_raw()

## Arguments

... Unquoted names of existing objects to save. If FALSE, saves each object in its own .rda file in the data/ directory. These data files bypass the usual export mechanism and are available whenever the package is loaded (or via data() if LazyData is not true). If TRUE, stores all objects in a single R/sysdata.rda file. Objects in this file follow the usual export rules. Note that this means they will be exported if you are using the common exportPattern() rule which exports all objects except for those that start with .. By default, use_data() will not overwrite existing files. If you really want to do so, set this to TRUE. Choose the type of compression used by save(). Should be one of "gzip", "bzip2", or "xz".

# NOT RUN {
# }