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
install.packages("quantmod") #有安裝過quantmod套件可以不用 | |
require("quantmod") #或是library(quantmod) 去引用quantmod | |
getSymbols("2330.TW",src="yahoo",from="2016-01-01",to=Sys.Date()) #from改成自己要的起日 | |
TSMCTW<-get("2330.TW") #因為台股股號是數字,用數字繪圖會有問題 | |
chartSeries(TSMCTW) #或是barChart(TSMCTW) | |
#備註: | |
#如果要把遠端Linux主機跑的繪圖結果傳到本機要用X11 forwarding | |
#WINDOWS可以下載安裝Xming X Server for Windows ( https://sourceforge.net/projects/xming/ ) | |
使用chartSeries函數繪圖結果:
沒有留言:
張貼留言