运行以下函数时出现一个奇怪的错误:
TypeIDs=c(18283,18284,17119,17121,17123,17125,17127,17129,17131,17133,18367,18369,18371,18373,18375,18377,18379)
featsave<-function(featfile,TypeIDs=TypeIDs) {
mydata1<-read.table(featfile,header=TRUE)
mydata2<-subset(mydata1,TypeID %in% TypeIDs)
mydata<-as.data.frame(cast(mydata2, Feat1 + Feat2 + ID ~ TypeID,value="value"))
save(mydata,file="mydatafile.Rdata",compress=TRUE)
return(mydata)
}
使用以下数据:
Feat1 Feat2 ID Feat3 Feat4 TypeID value
1 1 1 6 266 18283 280.00
1 1 1 6 266 18284 20.00
1 1 1 6 266 18285 0.00
1 1 1 6 266 17116 0.00
1 1 1 6 266 17117 0.00
1 1 1 6 266 17118 0.00
1 1 1 6 266 17119 68.75
1 1 1 6 266 17120 0.00
1 1 1 6 266 17121 1.26
我得到的错误是:
Error in inherits(x, "factor") :
promise already under evaluation: recursive default argument reference or earlier problems?
此错误发生在mydata2
我获取数据子集的行上。我似乎无法调试它,因为如果我改为在解释器中运行函数的每一行,我将不再收到错误。是什么赋予了?