R aggregate data.frame with date column

前端 未结 4 1136
挽巷
挽巷 2020-12-18 13:33

I have the data frame resambling the one in the below

Date       Expenditure Indicator
29-01-2011 5455        212
25-01-2012 5452        111
11-02-2011 365           


        
4条回答
  •  一个人的身影
    2020-12-18 14:07

    Upgrade from base and use data.table instead to simplify (and speed up) your code/life:

    library(data.table)
    
    dt = as.data.table(dta)
    
    dt[, lapply(.SD, sum), by = Date]
    

提交回复
热议问题