How can I do nested aggregation in data.table. For example I'd like to get the percentage of the different gears by cyl. 

```
library(data.table)
a <- as.data.table(mtcars)
a[,{
  n_cyl=.N
  .SD[,.(n_cyl,N_cyl_gear=.N,div1=N_cyl_gear/n_cyl),by=gear]
  },by=cyl]

```