Skip to content

Instantly share code, notes, and snippets.

@tjake
Created May 11, 2012 17:24
Show Gist options
  • Save tjake/2661144 to your computer and use it in GitHub Desktop.
Save tjake/2661144 to your computer and use it in GitHub Desktop.
#Load RJDBC
library(RJDBC)
#Load in the Cassandra-JDBC diver
cassdrv <- JDBC("org.apache.cassandra.cql.jdbc.CassandraDriver",
list.files("/Users/jake/workspace/bdp/resources/cassandra/lib/",pattern="jar$",full.names=T))
#Connect to Cassandra node and Keyspace
casscon <- dbConnect(cassdrv, "jdbc:cassandra://localhost:9160/PortfolioDemo")
#Query timeseries data
res <- dbGetQuery(casscon, "select * from StockHist limit 10")
#Transpose
tres <- t(res[2:10])
#Plot
boxplot(tres,names=res$KEY,col=topo.colors(length(res$KEY)))
title("BoxPlot of 10 Stock Price Histories")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment