问题
I have below data.frame
> str(luc) 'data.frame': 19 obs. of 4 variables: $ driver : Factor w/ 16 levels "nr #1","nr #10",..: 1 9 10 11 12 13 14 15 16 2 ... $ position: Factor w/ 16 levels "pos #1","pos #10",..: 1 9 10 11 12 13 14 15 16 2 ... $ ate : num 2 2 2 2 2 2 2 2 2 1 ... $ i2 : num 0.00656 0.00676 0.00679 0.00681 0.00666 0.00657 0.00674 0.00676 0.00682 0.00684 ...
> luc driver position ate i2 1 nr #1 pos #1 2 0.00656 2 nr #2 pos #2 2 0.00676 3 nr #3 pos #3 2 0.00679 4 nr #4 pos #4 2 0.00681 5 nr #5 pos #5 2 0.00666 6 nr #6 pos #6 2 0.00657 7 nr #7 pos #7 2 0.00674 8 nr #8 pos #8 2 0.00676 9 nr #9 pos #9 2 0.00682 10 nr #10 pos #10 1 0.00684 11 nr #11 pos #11 2 0.00671 12 nr #12 pos #12 2 0.00673 13 nr #13 pos #13 2 0.00660 14 nr #14 pos #14 2 0.00672 15 nr #15 pos #15 2 0.00673 16 nr #16 pos #16 2 0.00654 17 nr #7 pos #1 2 0.00678 18 nr #3 pos #2 2 0.00680 19 nr #1 pos #3 2 0.00658
which is extremely close to ss.data.rr provided by the SixSigma package.
Calling ss.rr with ss.data.rr works but what ever I try I always get below error when using luc:
> ss.rr(var=i2, appr=driver, part=ate, data=luc) Error in ``row.names<-.data.frame``(`*tmp*`, value = value) : invalid 'row.names' length
How to get rid of it?
Full code below; I create data.frame(luc) from much larger dataset.
library("SixSigma")
luc <- subset(cf, cf$CntrlVal == 85)
luc <- data.frame(cbind(luc$DriverNumber, luc$Position, luc$ATE, luc$I2))
colnames(luc)<-c("driver", "position", "ate", "i2")
luc$position <- as.factor(paste0("pos #", luc$position))
luc$driver<- as.factor(paste0("nr #", luc$driver))
luc[10, c("ate")] <- 1
luc<-luc[-c(20:48), ]
ss.rr(var=i2, appr=driver, part=ate, data=luc)
ss.rr(var=i2, appr=driver, part=position, data=luc)
回答1:
Gage R&R needs repeated measures in order to assess the Measurement System. Apparently, the data set contains only one observation for each combination of factors (if any). For example, the ss.data.rr data.frame has 3 measurements of each prototype for each operator:
table(ss.data.rr$prototype, ss.data.rr$operator)
op #1 op #2 op #3
prot #1 3 3 3
prot #2 3 3 3
prot #3 3 3 3
The error is due to the fact that there is not a "Residuals" row in the anova table (Repeatibility component of variation). I will code an informative error in the next version of SixSigma.
来源:https://stackoverflow.com/questions/41289923/r-project-sixsigma-ss-rr-gives-error-in-row-names-data-frametmp-value