Learn R Programming

db.r

Warning: There is a bug when using db.r in RStudio. We are working on resolving the issue!

Installation

On CRAN

> install.packages("db.r")

Using devtools

> library(devtools)
> devtools::install_github("yhat/db.r")

Database specific packages. You'll probably need one or many of these.

> devtools::install_url("http://cran.r-project.org/src/contrib/RSQLite_1.0.0.tar.gz")
> devtools::install_url("http://cran.r-project.org/src/contrib/RMySQL_0.9-3.tar.gz")
# not sure why but Postgres needs to be downloaded manually
# http://cran.r-project.org/src/contrib/RPostgreSQL_0.4.tar.gz
# unzip, then
> devtools::install("/path/to/RPostgreSQL_0.4")

Whirlwind Tour

> library(db.r)
> db <- DB(username="kermit", password="rainbowconnection",
    hostname="dw.muppets.com", dbname="muppetdb", dbtype="postgres")
> db$tables
> db$tables$jokes
> db$tables$jokes$head()
> db$tables$jokes$all()
> db$tables$jokes$sample()
> db$query("select * from jokes;")
> db$query_from_file("joke_query.sql")
> db$find_table("jok*")
> db$find_column("*id*")

TODO

  • Database Support
    • postgres
    • redshift
    • mysql
    • sqlite
    • mssql
    • oracle

Copy Link

Version

Monthly Downloads

33

Version

0.1.3

License

FreeBSD

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

February 15th, 2017

Functions in db.r (0.1.3)

DemoDB

Demo database for testing and examples.
db.new

Connection to a database
queries.mysql

Queries for Mysql
db.r

Explore databases interactively using the R shell
queries.sqlite

Queries for SQLite
queries.pg

Queries for Postgres
queries.redshift

Queries for Redshift
DB

Connection to a database