I get a strange error when I run the following function:
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) }
with the following data:
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
The error I am getting is:
Error in inherits(x, "factor") : promise already under evaluation: recursive default argument reference or earlier problems?
This error occurs on the line mydata2 , where I get a subset of the data. I cannot debug it, because if I run each function line in the interpreter instead, I no longer get the error. What gives?