问题描述
我有一个按日期索引的交货时间值的数据框,如下所示:
date.index = 1:100
delivery.time = rnorm(100,mean = 40)
data = data.frame(index,delivery.time)
index delivery.time
1 1 41.24375
2 2 39.80160
3 3 38.70970
4 4 40.73388
5 5 39.71060
6 6 41.57960
我想使用“ qicharts2”包为交货时间创建一个S-Chart。 我希望使用前25个值来确定基线和控制范围,然后使用17个连续值的样本来计算图表上的点。
我使用以下代码创建了S-Chart,但我正在努力定义样本大小。
qic(date.index,delivery.time,data = data,chart = 's',freeze = 25,# I believe this sets the number of values used for computing the baselines.
n = 17,# I believe this sets the sample size,but when I use this I get an error.
title = 'Delivery Time standard deviation (S chart)',ylab = 'Delivery Time',xlab = 'Date')
仅当删除n = 17
参数时,此代码才有效;如果将其保留在代码中,则会出现以下错误消息:
Error in stats::complete.cases(y,n) :
not all arguments have the same length
我认为这是因为n
应该是与数据帧长度相同的向量,但是向量又是什么?现在,我将尝试生成一个新列,其中在25号之后的每个17个值都分配有一些唯一索引,然后将该列用作n。如果有人能阐明这是否行得通,我将不胜感激。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)