R中的时间序列
这是我的问题:
我有这些数据
summary(data)
Date
1990/01: 1
1990/02: 1
1990/03: 1
1990/04: 1
1990/05: 1
1990/06: 1
(Other):242
attribute
Min. :164.9
1st Qu.:201.5
Median :244.1
Mean :274.6
3rd Qu.:313.3
Max. :512.1
NA's : 1.0
,我想绘制一个时间序列图
,所以我尝试了这个:
qplot(as.Date(Date, "%Y/%m/%d"), attribute, data = data, geom = "line", main="Attribute per month 1990-2010", xlab="month-year", ylab="attribute" , colour = I("steelblue4"),fill = I("steelblue4"))
我得到了:
seq.int(r1$year, to$year, by) 中的错误:“from”必须是有限的
另外:警告消息:
1:在 min(x) 中:min 没有非缺失参数;返回信息
2:在 max(x) 中:max 没有非缺失参数;返回 -Inf
有什么想法可以解决吗?
谢谢
here is my question:
i have these data
summary(data)
Date
1990/01: 1
1990/02: 1
1990/03: 1
1990/04: 1
1990/05: 1
1990/06: 1
(Other):242
attribute
Min. :164.9
1st Qu.:201.5
Median :244.1
Mean :274.6
3rd Qu.:313.3
Max. :512.1
NA's : 1.0
and i want to draw a time series plot
so i tried this:
qplot(as.Date(Date, "%Y/%m/%d"), attribute, data = data, geom = "line", main="Attribute per month 1990-2010", xlab="month-year", ylab="attribute" , colour = I("steelblue4"),fill = I("steelblue4"))
and i got:
Error in seq.int(r1$year, to$year, by) : 'from' must be finite
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
any ideas to solve it?
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此转换
as.Date(Date, "%Y/%m/%d")
为所有值提供NA
。尝试 as.Date(paste(Date,"01",sep="/"), "%Y/%m/%d")。
This conversion
as.Date(Date, "%Y/%m/%d")
gives youNA
for all values.Try
as.Date(paste(Date,"01",sep="/"), "%Y/%m/%d")
.