I sometimes want to check the number of rows for each value of a variable.
I use the following method. The first syntax doesn't work, but the second
does. I think that they ought to give the same result.
> DT <- data.table(x=rep(c(1, 2), each=10), y=1:20)
> DT[, length(x), list(x)]
x V1
[1,] 1 1
[2,] 2 1
> DT[, length(y), list(x)]
x V1
[1,] 1 10
[2,] 2 10
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help