d3js: blank template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vis = d3.select("#visualisation"); | |
function update () { | |
var circles = vis.selectAll("circle").data(randomData(), function (d) { return d.id; }); | |
circles.enter() | |
.insert("svg:circle") | |
.attr("cx", function (d) { return d.value1; }) | |
.attr("cy", function (d) { return d.value2; }) | |
.style("fill", "red"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
</head> | |
<body> | |
<h1>This is a test</h1> | |
<script> | |
d3.select("body").append("p").html("Hello World!"); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Drought | |
### A drought is a flat period in performance. | |
### The max drought is the longest flat period in a track record. | |
### The current drought is the current flat period in a track record. | |
require(devtools) | |
install_github("r_jfreels","jfreels") | |
# load data | |
require(PerformanceAnalytics) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype HTML> | |
<html> | |
<head> | |
<link rel='stylesheet' href='http://cdn.strategiqcommerce.com/ajax/libs/rickshaw/1.2.1/rickshaw.min.css'> | |
<link rel='stylesheet' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css'> | |
<script src='http://d3js.org/d3.v2.min.js' type='text/javascript'></script> | |
<script src='http://cdn.strategiqcommerce.com/ajax/libs/rickshaw/1.2.1/rickshaw.min.js' type='text/javascript'></script> | |
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' type='text/javascript'></script> | |
<script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js' type='text/javascript'></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype HTML> | |
<html> | |
<head> | |
<link rel='stylesheet' href='http://cdn.strategiqcommerce.com/ajax/libs/rickshaw/1.2.1/rickshaw.min.css'> | |
<link rel='stylesheet' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css'> | |
<script src='http://d3js.org/d3.v2.min.js' type='text/javascript'></script> | |
<script src='http://cdn.strategiqcommerce.com/ajax/libs/rickshaw/1.2.1/rickshaw.min.js' type='text/javascript'></script> | |
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' type='text/javascript'></script> | |
<script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js' type='text/javascript'></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Drawdown using plyr / data.table | |
vami<-function (ror) { cumprod(na.omit(ror) + 1) } | |
dd<-function (ror) { -(1 - vami(ror)/cummax(c(1, cummax(vami(ror))))[-1]) } | |
require(PerformanceAnalytics) | |
require(plyr) | |
require(reshape2) | |
require(data.table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
knit_expand() example | |
======================================================== | |
```{r, label='setup', include=FALSE} | |
require(data.table) | |
require(PerformanceAnalytics) | |
require(reshape2) | |
opts_chunk$set(eval=TRUE,echo=FALSE) | |
data(edhec) | |
edhec<-data.table(melt(data.frame(date=index(edhec),coredata(edhec)),id.vars='date')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"date" : [ | |
"1997-01-31", | |
"1997-02-28", | |
"1997-03-31", | |
"1997-04-30", | |
"1997-05-31", | |
"1997-01-31", | |
"1997-02-28", | |
"1997-03-31", |
OlderNewer