Skip to content

Instantly share code, notes, and snippets.

@lynaghk
Created July 4, 2011 05:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lynaghk/1062939 to your computer and use it in GitHub Desktop.
Save lynaghk/1062939 to your computer and use it in GitHub Desktop.
R + Sqlite example
# Run this first:
#
# install.packages(c('RSQLite.extfuns', 'ggplot2', 'maps'))
#
library(RSQLite)
library(ggplot2)
library(RSQLite.extfuns)
db = dbConnect(
dbDriver("SQLite")
, dbname = 'watershed_database.db'
, loadable.extensions = TRUE)
#dbGetQuery just returns a data frame
pods = dbGetQuery(db, "
SELECT category, subbasin_name, quantity, geox, geoy
FROM pods
WHERE lic_status = 'CURRENT'
AND quantity IS NOT NULL")
summary(pods$quantity)
ggplot(data=pods) +
geom_point(aes(x=geox
, y=geoy
, color=category
, size=quantity))
Copy link

ghost commented Jan 13, 2013

Where can I find the data to create watershed_database.db ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment