Skip to content

Instantly share code, notes, and snippets.

@iambibhas
Created November 6, 2013 17:11
Show Gist options
  • Save iambibhas/7340128 to your computer and use it in GitHub Desktop.
Save iambibhas/7340128 to your computer and use it in GitHub Desktop.
Just the basic commands to connect to a PostgreSQL database from R and read a table or a query.
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname="test", host="localhost", user="test", password="")
rs <- dbSendQuery(con, "select * from schools_school")
dframe <-dbReadTable(con,"schools_school").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment