Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R-自动批函数_R_Ggplot2_Statistics_Time Series_Ggfortify - Fatal编程技术网

R-自动批函数

R-自动批函数,r,ggplot2,statistics,time-series,ggfortify,R,Ggplot2,Statistics,Time Series,Ggfortify,嗨,我在R中运行一个ggfortify包,它允许在R中定制时间序列图 见链接 该链接显示了绘图上颜色变化的示例: library(ggfortify) autoplot(AirPassengers, ts.colour = 'blue') 在我的代码中,我安装了打包的并加载了ggfortify库,但是在我键入它时,它不会显示这个ts.color函数 我的代码: autoplot(sales, ts.colour = 'blue') 与上面类似,但以黑色显示,样式应包括背景,但与打印颜色或厚

嗨,我在R中运行一个ggfortify包,它允许在R中定制时间序列图

见链接

该链接显示了绘图上颜色变化的示例:

library(ggfortify) 
autoplot(AirPassengers, ts.colour = 'blue')
在我的代码中,我安装了打包的并加载了ggfortify库,但是在我键入它时,它不会显示这个ts.color函数

我的代码:

autoplot(sales, ts.colour = 'blue')
与上面类似,但以黑色显示,样式应包括背景,但与打印颜色或厚度没有差异


非常感谢

参数
ts.color
仅适用于时间序列对象。如果运行
str(sales)
它应该返回类似于:“时间序列[1:144]…”

如果没有,则您可以尝试使用以下方法进行转换:

ts(销售,开始=c(2012,1),结束=c(2016,2),2)

ggfortify试图从标绘对象
sales
推断出很多东西,因此请将注意力集中在这里。祝你好运

您的
sales
数据是否已使用类似于
as.ts(sales)
的东西转换为时间序列对象?如果它只是一个数据帧,那么
autoplot
将不会以同样的方式工作。“str(销售)时间序列[1:18]从2012年到2016年:185189195199211…”看起来就像我以前变成了一个时间序列数据集,但ts.color和其他功能似乎不起作用。感谢您这似乎是一个真正的bug,您可能需要向包作者报告;)