金融関連指数の時系列チャート:chartSeries

Sys.time()
## [1] "2014-09-19 14:55:03 JST"

Package

#install.packages("knitr", dependencies=T)
#install.packages("quantmod", dependencies=T)
library(knitr)
library(quantmod) # http://cran.r-project.org/web/packages/quantmod/quantmod.pdf

Import Data & Plot

FirstDate<-as.Date("2014/1/1")
LastDate<-as.Date("2014/12/31")
symbol<-c("^GSPC","yahoo","^FTSE","yahoo","^N225","yahoo","FB","yahoo","TWTR","yahoo","MCD","yahoo")
par(mar=c(5,5,5,5),ps=14,cex.axis=1,cex.lab=1,cex.main=1,cex.sub=1)
for(iii in seq(1,length(symbol),by=2)){
StockPrice<-getSymbols(symbol[iii],src=symbol[iii+1],auto.assign=FALSE,from=FirstDate,to=LastDate)
stock<-gsub("\\^","",symbol[iii])
chartSeries(StockPrice,type="candlesticks",name=stock) # "auto", "candlesticks", "matchsticks", "bars","line"
cat("\n","\n","\n")
}

plot of chunk unnamed-chunk-3

plot of chunk unnamed-chunk-3

plot of chunk unnamed-chunk-3

plot of chunk unnamed-chunk-3

plot of chunk unnamed-chunk-3

plot of chunk unnamed-chunk-3