-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathexample.Rmd
51 lines (37 loc) · 1.11 KB
/
example.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: "dcStockR Test"
author: "Hiroaki Yutani"
date: "2/17/2015"
output: html_document
---
This should be same as the original charts of ["Nasdaq 100 Index 1985/11/01-2012/06/29"](http://dc-js.github.io/dc.js/)
```{r}
library(dcStockR)
library(httr)
library(lubridate)
```
Get data from dc-js's repo.
```{r, cache=TRUE}
res <- GET("https://github.com/dc-js/dc.js/raw/master/web/ndx.csv")
ndx <- content(res, type = "text/csv")
ndx$date <- as.character(mdy(ndx$date))
```
Draw charts.
```{r}
# yearlyBubbleChart
dc(ndx, "yearlyBubbleChart", title = "Yearly Performance (radius: fluctuation/index ratio, color: gain/loss)")
# gainOrLossChart
dc(ndx, "gainOrLossChart", title = "Days by Gain/Loss", height = 300)
# quarterChart
dc(ndx, "quarterChart", title = "Quarters", height = 300)
# dayOfWeekChart
dc(ndx, "dayOfWeekChart", title = "Day of Week", height = 300)
# fluctuationChart
dc(ndx, "fluctuationChart", title = "Days by Fluctuation(%)", height = 300)
# moveChart
dc(ndx, "moveChart", title = "Monthly Index Abs Move & Volume/500,000 Chart")
# dataCount
dc(ndx, "dataCount")
# dataTable
dc(ndx, "dataTable")
```