Closed pepelisu closed 7 years ago
Thanks!
So the problem starts when doing toy_data[, .(counts=sum(moving)), by=.(id,t)]
.
This changes the key:
data.table::key(summary_toy_data)
#> [1] "id" "t"
The default behaviour of behavr
(pun intended ;)) is to coherce the returned table to a data.table
.
Then rejoin fails.
So we should:
behavr
table see #4 A simple and efficient way to do it. We group by ID, then, within each group, we resample/aggregate:
summary_toy_data <- toy_data[,
.SD[, .(count=sum(moving)), by="t"],
by="id"]
After creating some data with
toy_*_data
, and summarizing it usingrejoin
gives back an emptydata.table
.Steps to reproduce:
summary_all
is then a empty data.table.