Skip to content

Instantly share code, notes, and snippets.

timelyportfolio timelyportfolio

Block or report user

Report or block timelyportfolio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View code.R
library(rCharts)
p2 <- nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'scatterChart')
p2$xAxis(axisLabel = 'Weight')
p2$chart(size = '#! function(d){return d.gear} !#')
p2$chart(color = c('red', 'green', 'blue'))
p2$chart(
tooltipXContent = NA,
tooltipYContent = NA
)
p2$chart(
@timelyportfolio
timelyportfolio / code.R
Last active Aug 29, 2015
example in response to rCharts issue #381 ; correlation plot with dimplejs
View code.R
#forked from https://gist.github.com/patilv/7073094
library(rCharts)
library(reshape2)
findata=read.csv("https://raw.github.com/patilv/rChartsTutorials/master/findata.csv")
# These are data regarding NCAA athletic department expenses at public universities. Please see the blog post where these charts were originally used
# regarding more details on the origins of these data.: http://analyticsandvisualization.blogspot.com/2013/10/subsidies-revenues-and-expenses-of-ncaa.html
findata=findata[,-c(1:3)] # removing first dummy column - the csv quirk - second column on Rank, and third column on School. Retaining only numeric vars here
corrmatrix<-cor(findata) #store corr matrix
# The following steps are generic and can all be placed in a function with some tweaks to customize output
@timelyportfolio
timelyportfolio / code.R
Last active Aug 29, 2015
Dow Jones Industrial Average 1987 with dimple + rCharts
View code.R
require(dplyr)
require(quantmod)
getSymbols("DJIA", src = "FRED")
roc <- na.omit(merge(ROC(DJIA,n=1),ROC(DJIA,n=250)))
require(rCharts)
require(latticeExtra)
require(directlabels)
@timelyportfolio
timelyportfolio / index.html
Created Apr 12, 2014
rCharts example #381 using dimplejs and a custom tooltip
View index.html
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://dimplejs.org/dist/dimple.v1.1.5.min.js' type='text/javascript'></script>
<style>
.rChart {
@timelyportfolio
timelyportfolio / Readme.md
Last active Aug 29, 2015
bar correlation plot example for rCharts issue 381 using dimplejs
View Readme.md
@timelyportfolio
timelyportfolio / Readme.md
Last active Aug 29, 2015
rCharts + factorAnalytics | french/fama & frazzini/pedersen
View Readme.md

factor data from

Betting against Beta factors used in Frazzini A and L.H. Pedersen (2013), “Betting Against Beta"
Fama and French, 1993
"Common Risk Factors in the Returns on Stocks and Bonds"
Journal of Financial Economics
@timelyportfolio
timelyportfolio / index.html
Last active Aug 29, 2015
rCharts + PortfolioAnalytics | nvd3 sample
View index.html
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.js' type='text/javascript'></script>
@timelyportfolio
timelyportfolio / code.R
Last active Aug 29, 2015
US and Global Factors | rCharts + dimple.js Correlation Plot
View code.R
#full factor set for 1956-2012 from Andrea Frazzini Data
#http://www.econ.yale.edu/~af227/data_library.htm
#direct link to Excel File
#http://www.econ.yale.edu/~af227/data/QMJ%20factors%20-%20Asness,%20Frazzini%20and%20Pedersen.xlsx
#ssrn citation to the paper
#Asness, Clifford S. and Frazzini, Andrea and Pedersen, Lasse Heje
#Quality Minus Junk (October 9, 2013)
#Available at SSRN: http://ssrn.com/abstract=2312432
@timelyportfolio
timelyportfolio / code.R
Last active Aug 29, 2015
US and Global Factors | rCharts + dimple.js Cumulative Line Plot
View code.R
#full factor set for 1956-2012 from Andrea Frazzini Data
#http://www.econ.yale.edu/~af227/data_library.htm
#direct link to Excel File
#http://www.econ.yale.edu/~af227/data/QMJ%20factors%20-%20Asness,%20Frazzini%20and%20Pedersen.xlsx
#ssrn citation to the paper
#Asness, Clifford S. and Frazzini, Andrea and Pedersen, Lasse Heje
#Quality Minus Junk (October 9, 2013)
#Available at SSRN: http://ssrn.com/abstract=2312432
@timelyportfolio
timelyportfolio / Readme.md
Created May 1, 2014
lattice legend positioning example
View Readme.md

Some examples of legend positioning in R lattice. There is nearly infinite flexibility if there is strong desire for customization. This illustrates some of the options available.

A lot of times I like to avoid legends entirely and use the direct.labels package to label the graphics directly.

You can’t perform that action at this time.