From https://r-pkgs.org/data.html
If you want to store binary data and make it available to the user, put it in data/. This is the best place to put example datasets.
use_data_raw() # data-raw/mini_mtcars.R # Prepare mini_mtcars <- head(mtcars) usethis::use_data(mini_mtcars)
# R/mini_mtcars.R #' First six rows of [datasets::mtcars] #' #' A mini dataset for examples and tests. #' #' @source [datasets::mtcars] "mini_mtcars"
If you want to store parsed data, but not make it available to the user, put it in R/sysdata.rda. This is the best place to put data that your functions need.
# data-raw/sysdata.R mini_letters <- head(letters) mini_month <- head(month.abb) usethis::use_data(mini_letters, mini_month, internal = TRUE)
If you want to store raw data, put it in inst/extdata.
use_directory("inst/extdata") system.file("extdata", "iris.csv", package = "readr", mustWork = TRUE)
dput()
, tibble::tribble()
, datapasta::tribble_paste()
A simple alternative to these three options is to include it in the source of your package, either creating by hand, or using dput() to serialise an existing data set into R code.
datasets::BOD dput(datasets::BOD)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.