Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-dbi/RSQLite
R interface for SQLite
https://github.com/r-dbi/RSQLite
database r sqlite3
Last synced: 3 months ago
JSON representation
R interface for SQLite
- Host: GitHub
- URL: https://github.com/r-dbi/RSQLite
- Owner: r-dbi
- License: lgpl-2.1
- Created: 2013-05-26T19:47:56.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T01:44:08.000Z (7 months ago)
- Last Synced: 2024-04-14T10:56:34.682Z (7 months ago)
- Topics: database, r, sqlite3
- Language: R
- Homepage: https://rsqlite.r-dbi.org
- Size: 54.6 MB
- Stars: 321
- Watchers: 21
- Forks: 79
- Open Issues: 24
-
Metadata Files:
- Readme: README.Rmd
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/security.md
Awesome Lists containing this project
- jimsghstars - r-dbi/RSQLite - R interface for SQLite (R)
README
---
output: downlit::readme_document
---```{r setup, include = FALSE}
pkgload::load_all()
```# RSQLite
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![rcc](https://github.com/r-dbi/RSQLite/workflows/rcc/badge.svg)](https://github.com/r-dbi/RSQLite/actions)
[![Coverage Status](https://codecov.io/gh/r-dbi/RSQLite/branch/main/graph/badge.svg)](https://app.codecov.io/github/r-dbi/RSQLite?branch=main)
[![CRAN status](https://www.r-pkg.org/badges/version/RSQLite)](https://cran.r-project.org/package=RSQLite)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3234/badge)](https://bestpractices.coreinfrastructure.org/projects/3234)Embeds the SQLite database engine in R, providing a DBI-compliant interface. [SQLite](https://www.sqlite.org/index.html) is a public-domain, single-user, very light-weight database engine that implements a decent subset of the SQL 92 standard, including the core table creation, updating, insertion, and selection operations, plus transaction management.
You can install the latest released version from CRAN with:
```R
install.packages("RSQLite")
```Or install the latest development version from GitHub with:
```R
# install.packages("devtools")
devtools::install_github("r-dbi/RSQLite")
```Discussions associated with DBI and related database packages take place on [R-SIG-DB](https://stat.ethz.ch/mailman/listinfo/r-sig-db).
The website [Databases using R](https://db.rstudio.com/) describes the tools and best practices in this ecosystem.## Basic usage
```{r}
library(DBI)
# Create an ephemeral in-memory RSQLite database
con <- dbConnect(RSQLite::SQLite(), ":memory:")dbListTables(con)
dbWriteTable(con, "mtcars", mtcars)
dbListTables(con)dbListFields(con, "mtcars")
dbReadTable(con, "mtcars")# You can fetch all results:
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
dbFetch(res)
dbClearResult(res)# Or a chunk at a time
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
while (!dbHasCompleted(res)) {
chunk <- dbFetch(res, n = 5)
print(nrow(chunk))
}
# Clear the result
dbClearResult(res)# Disconnect from the database
dbDisconnect(con)
```## Acknowledgements
Many thanks to Doug Bates, Seth Falcon, Detlef Groth, Ronggui Huang, Kurt Hornik, Uwe Ligges, Charles Loboz, Duncan Murdoch, and Brian D. Ripley for comments, suggestions, bug reports, and/or patches.
---
Please note that the 'RSQLite' project is released with a
[Contributor Code of Conduct](https://rsqlite.r-dbi.org/code_of_conduct).
By contributing to this project, you agree to abide by its terms.