R/datasetsDb.R

Defines functions datasetsDb

Documented in datasetsDb

#' A sample sqlite database
#'
#' This database is bundled with the package, and contains all data frames
#' in the datasets package.
#'
#' @export
#' @examples
#' library(DBI)
#' db <- RSQLite::datasetsDb()
#' dbListTables(db)
#'
#' dbReadTable(db, "CO2")
#' dbGetQuery(db, "SELECT * FROM CO2 WHERE conc < 100")
#'
#' dbDisconnect(db)
datasetsDb <- function() {
  dbConnect(SQLite(), system.file("db", "datasets.sqlite", package = "RSQLite"),
    flags = SQLITE_RO
  )
}

Try the RSQLite package in your browser

Any scripts or data that you put into this service are public.

RSQLite documentation built on May 29, 2024, 3:30 a.m.