小编gia*_*gle的帖子

绘制R中的时间序列图

我需要在R中绘制一个时间序列.但是很难弄清楚如何使用这些格式.

dates <- c(20060901, 20060905, 20060906, 20060907, 20060908, 20060911)
values <- c(33.6, 32.0, 30.0, 30.0, 30.0, 28.4)
Run Code Online (Sandbox Code Playgroud)

需要将日期转换为适当的格式例如:20060901至Sep-01-2006,依此类推

到目前为止我的方法:

dates = as.Date(dates, "%Y%m%d")
plot(dates , values)
Run Code Online (Sandbox Code Playgroud)

但是,我收到以下错误:

Error in charToDate(x) : character string is not in a standard unambiguous format
Run Code Online (Sandbox Code Playgroud)

plot r timeserieschart

1
推荐指数
1
解决办法
1525
查看次数

标签 统计

plot ×1

r ×1

timeserieschart ×1