data-raw/datasets.R

tables <- unique(data(package = "datasets")$results[, 3])
tables <- tables[!grepl("(", tables, fixed = TRUE)]

con <- dbConnect(SQLite(), "inst/db/datasets.sqlite")
for (table in tables) {
  df <- getExportedValue("datasets", table)
  if (!is.data.frame(df)) next

  message("Creating table: ", table)
  dbWriteTable(con, table, as.data.frame(df), overwrite = TRUE)
}
rstats-db/RSQLite documentation built on April 20, 2024, 11:56 a.m.