我正在研究超过三年的16个世界指数,我想从这16个指数制作一个情节。
all<-read.table("C.../16indices.txt")
dimnames(all)[[2]]<-c("Date","BEL 20","CAC 40","AEX","DAX","FTSE 100","IBEXx 35","ATX","SMI","FTSE MIB","RTX","HSI","NIKKEI 225","S&P 500","NASDAQ","Dow Jones","BOVESPA")
attach(all)
问题
我不习惯和R.一起工作。我尝试过这样的事情,但是没有用......
plot(all[1,],all[,2])
答案 0 :(得分:0)
最大的问题是没有样本数据&gt;以下是基于猜测的建议:
I tried something like this but that didn't work... plot(all[1,],all[,2])
您需要将日期值格式化为R Date类。如果它们是YYYY-MM-DD格式,它将如下所示:
all$Date <- as.Date(all.Date)
针对您的具体问题:
1) My dates are written in the form "2009-01-05". I want only "2009" to appear otherwise i would have to many jumps.
您需要在绘图调用中禁止轴绘图,然后需要添加一个axis()调用。
2) For example the prices from the BOVESPA go from 40.000,15 to 60.000,137. How do I get nice y-labels? For instance 40.000, 45.000,...,60.000.
您似乎处于欧洲语言环境中,这意味着您的初始read.table调用可能会损坏数据输入,您需要阅读read.csv2
的文档,该文档将正确处理小数点和逗号的反转数字数据的含义。您还应该使用colClasses。
3) How do i get 16 of these plots in one nice figure/plot?
您可能应该从每个系列的初始起点计算比率,因此可以有一个共同的显示比例。