-1

I have a data frame data with about 500 rows. I perform the following action using dplyr but this gives me the following error:

C Stack usage 15924991 is too close to the limit

data<-data%>%group_by(Date)%>%mutate(val1=sum(as.numeric(val1)))%>%distinct(Date,.keep_all=TRUE)%>%ungroup()

TIA

Phil
  • 5,491
  • 3
  • 26
  • 61
  • Seems to me like you could achieve the same with `data %>% group_by(Date) %>% summarise(val1=sum(as.numeric(val1)))`. Does this resolve the issue? – jpiversen May 29 '22 at 10:01
  • Nope, still getting the same error – hereforadoubt May 29 '22 at 10:12
  • You don't specify how many cols you have. That said, have you tried increasing the stack size in R? See https://stackoverflow.com/questions/43181989/how-to-set-the-size-of-the-c-stack-in-r among others. This error usually happens because of recursion gone wild. Deeply nested structures can be one reason, but there are others. Check your code. – John Garland May 29 '22 at 13:23

0 Answers0