split
for a data.table that keeps integrity of a column of lists of data.table objectsdata.table::split
does 2 bad things:
reorders if using f
destroys the integrity of a column that is a list of data.tables, when using by
So, to keep order, need by
, but to keep integrity, need f
. This function
splitKeepOrderAndDTIntegrity(pkgDT, splitOn)
A list of data.table
objects of length(unique(splitOn))
.
A pkgDT
object e.g., from toPkgDT
Character vector passed to data.table::split(..., f = splitOn)