Is it possible to aggregate data.table using column number and not column names in large dataset?

Viewed 558

I'm trying to aggregate a data.table. To be more precise, i have a data.table with 202 column, i want to aggregate(dt[,131:202]~dt[,1:130],data=dt,FUN=sum). Here is a data.table so you can try to do it.

A <- c(1,2,3,4,4,6,4)
B <- c("a","b","c","d","e","f","g")
C <- c(10,11,23,8,8,1,3)
D <- c(2,3,5,9,7,8,4)
E <- c(2,5,7,1,4,6,15)
G <- c("b","f","s","k","t","r","n")
H <- c(2,68,5,27,11,17,4)


dt <- data.table(A,B,C,D,E,G,H)
1 Answers
Related