-
-
Save jkaupp/86a398e2f68349091767 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
stock <- "MSFT" | |
start.date <- "2012-01-01" | |
end.date <- Sys.Date() | |
quote <- paste("http://ichart.finance.yahoo.com/table.csv?s=", | |
stock, | |
"&a=", substr(start.date,6,7), | |
"&b=", substr(start.date, 9, 10), | |
"&c=", substr(start.date, 1,4), | |
"&d=", substr(end.date,6,7), | |
"&e=", substr(end.date, 9, 10), | |
"&f=", substr(end.date, 1,4), | |
"&g=d&ignore=.csv", sep="") | |
stock.data <- read.csv(quote, as.is=TRUE) | |
stock.data$Date <- as.Date(stock.data$Date) | |
## Uncomment the next 3 lines to install the developer version of googleVis | |
# install.packages(c("devtools","RJSONIO", "knitr", "shiny", "httpuv")) | |
# library(devtools) | |
# install_github("mages/googleVis") | |
library(googleVis) | |
plot( | |
gvisCalendar(data=stock.data, datevar="Date", numvar="Adj.Close", | |
options=list( | |
title="Calendar heat map of MSFT adjsuted close", | |
calendar="{cellSize:10, | |
yearLabel:{fontSize:20, color:'#444444'}, | |
focusedCellColor:{stroke:'red'}}", | |
width=590, height=320), | |
chartid="Calendar") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment