I have notice that the following two commands yield very different results, so I was wondering what the difference is ?
TestData <- TestData[, keyby = c("group","date"),
.(totalCount = sum(count))]
TestData <- TestData[, by = c("group","date"),
.(totalCount = sum(count))]
according to the cheatsheet:
dt[, j, by = .(a)] – group rows by values in specified columns.
and
dt[, j, keyby = .(a)] – group and simultaneously sort rows by values in specified columns.