Learning from the Best | NYT and Ramnath Vaidyanathan
Sources:
Using rCharts dimple.js new functionality, demonstrate how to do this in dimple.js. Ramnath originally used polycharts.
<!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 { |
Sources:
Using rCharts dimple.js new functionality, demonstrate how to do this in dimple.js. Ramnath originally used polycharts.
<!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> |
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" |
#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 |
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])), |
hair_eye_male = subset(as.data.frame(HairEyeColor), Sex == "Male") | |
n1 <- nPlot(Freq ~ Hair, | |
group = 'Eye', | |
data = hair_eye_male, | |
type = 'multiBarChart' | |
) | |
n1 |
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.