Ok, I am stuck with trying to use data.table package to group and sum two separate columns.
My DT:
PARK WTG T_stop T_AF
PC 81970 4.743 4.742
PC 81970 48.850 47.462
PC 81970 16.714 0.000
PC 81970 0.121 0.115
PC 81970 0.004 0.004
PC 81970 0.015 0.000
PC 81970 0.049 0.046
PC 81970 0.090 0.090
PC 81970 0.060 0.060
PC 81970 0.163 0.152
Now using the data.table function I have tried:
DT[, lapply(.SD, sum), by = c("PARK", "WTG")]
but my results look like this:
PARK WTG T_stop T_AF
PC 81970 70.808 5.267
What I am looking for is:
PARK WTG T_stop T_AF
PC 81970 70.808 52.671
Now this is just a snippet of my data set with around 700 rows
DT[, lapply(.SD,sum), by = .(PARK, WTG)]
– Mako212