Skip to content

Instantly share code, notes, and snippets.

View timelyportfolio's full-sized avatar

timelyportfolio timelyportfolio

View GitHub Profile
@timelyportfolio
timelyportfolio / index.html
Last active August 29, 2015 13:56
dimple.js max min issues with multiple series
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://dimplejs.org/dist/dimple.v1.1.4.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.js' type='text/javascript'></script>
<style>
.rChart {
@timelyportfolio
timelyportfolio / Readme.md
Last active August 29, 2015 13:56
Ramnath NYT Baseball with Dimple
@timelyportfolio
timelyportfolio / index.html
Last active August 29, 2015 13:56
work on @ramnathv datamaps plugin
<!DOCTYPE html>
<meta name="description" content="Datamaps Hexbin Plugin" />
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/d3.hexbin.v0.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<!-- I recommend you host this file on your own, since this will change without warning -->
<script src="http://datamaps.github.io/scripts/datamaps.usa.js?v=1"></script>
<p>Datamaps Hexbin Plugin</p>
@timelyportfolio
timelyportfolio / code.R
Last active August 29, 2015 13:56
rCharts Polycharts Heatmap Issue # 77
data.new <- data.frame(id = 1:1000)
data.new$Employer <- c("aaa","bbb","ccc","ddd","eee")[runif(n=1000,min=1,max=6)]
data.new$Type <- c("Nonacademic", "Postdoc", "Fixed Term Academic", "Other Tenure Track", "Research University")[runif(n=1000,min=1,max=6)]
data.new$Year <- c("2010","2011","2012","2013")[runif(n=1000,min=1,max=5)]
data.new <-
data.frame(xtabs( ~ Employer + Type + Year, data = data.new))
colnames(data.new)[4] <- "Value"
@timelyportfolio
timelyportfolio / code.R
Last active August 29, 2015 13:56
rCharts issue 77 - dimple example
#install_github("rCharts","timelyportfolio",ref="dimple_layer")
require(rCharts)
data.new <- data.frame(id = 1:1000)
data.new$Employer <- c("aaa","bbb","ccc","ddd","eee")[runif(n=1000,min=1,max=6)]
data.new$Type <- c("Nonacademic", "Postdoc", "Fixed Term Academic", "Other Tenure Track", "Research University")[runif(n=1000,min=1,max=6)]
data.new$Year <- c("2010","2011","2012","2013")[runif(n=1000,min=1,max=5)]
data.new <-
data.frame(xtabs( ~ Employer + Type + Year, data = data.new))
example.md: example.Rmd
Rscript ./knit
example.ipynb: example.md
c://python27_64/scripts/notedown example.md | sed 's/%%r/%%R/' > example.ipynb
@timelyportfolio
timelyportfolio / code.R
Last active August 29, 2015 13:57
sp500 and vix nvd3 scatter with rCharts
require(rCharts)
#nvd3 rCharts do not show up in Rstudio viewer
#so turn viewer off
options(viewer=NULL)
require(quantmod)
getSymbols(c("^VIX","^GSPC"),from="2012-01-01")
roc <- ROC(
na.omit(merge(VIX[,4],GSPC[,4])),
@timelyportfolio
timelyportfolio / Readme.md
Last active August 29, 2015 13:57
rCharts dimplejs rendition of bfast on S&P 500

rCharts + dimplejs Visualization of bfast on S&P 500

Analyze breakpoints with the R package bfast with an interactive d3.js visualization using rCharts and the dimplejs library.

R bfast code from blog post

For a better understanding of bfast please see the following paper.

Verbesselt J, Hyndman R, Newnham G, Culvenor D (2010)
@timelyportfolio
timelyportfolio / code.R
Last active August 29, 2015 13:57 — forked from ramnathv/code.R
hair_eye_male = subset(as.data.frame(HairEyeColor), Sex == "Male")
n1 <- nPlot(Freq ~ Hair,
group = 'Eye',
data = hair_eye_male,
type = 'multiBarChart'
)
n1
@timelyportfolio
timelyportfolio / Readme.md
Last active August 29, 2015 13:57
rCharts parallel coordinates version of market returns

Quick combination of parallel coordinates and rCharts to show returns by year and annualized returns since 2007 of three index ETFs (SPY, EEM, and VEA). This could easily be extended to other risk/return data points on a much larger sets of indices, asset classes, or securities.

Thanks to d3.js, parallel coordinates, rCharts, R, and PerformanceAnalytics.

Data from Yahoo! Finance for personal educational use.