0
Good afternoon,
I’m using the code:
soma<-aggregate(as.numeric(coop[c(10,18,26,34,42,50,58,66)]), by=list(coop$data), FUN=sum, na.rm=TRUE)
to aggregate the data based on the date key, which is in date format. I tried to change this variable to numeric or string, but returns the same error:
Error in aggregate(as.numeric(coop[c(10, 18, 26, 34, 42, 50, 58, 66)]),:
(list) object cannot be coerced to type 'double'
What should I be doing? I have done several other races and I had not come across this error. There are values in NA at the base, but I do not believe that this is the problem.
Try to make your code playable!
– Robert
coop
does not seem to me to be a vector, but rather a data.frame. Therefore, it seems to me that you need to select which column you are aggregating. The way you’re doing:coop[c(...)]
you are selecting several lines of a data.frame (which is equal to a list) and cannot be converted to a numeric value.– Daniel Falbel
The problem is when converting Coop[c(...)] into numeric.
– T. Veiga
yes, because this cannot be converted to numeric: it is a data.frame. which gives
class(coop[c(...)])
– Daniel Falbel
You’re right. Silly me. I took and turned everything into numerical: data[,10:67]<-sapply(data[,10:67], as.)
– T. Veiga