I have a table dtTrain which has many columns. I am trying to perform 4 aggregation columns on each, [Min, Max, sd, mean]. To do this I am running the line
subTrain <- dtTrain[,c(min = lapply(.SD, min),
max = lapply(.SD, max),
sd = lapply(.SD, sd),
mean = lapply(.SD, mean)), by=TrialID]
The problem I am having is the aggregation is working but the column headers are repeated (ie column1 is produced four times in the subTrain table).
I would prefer [column1.min,...,column1.max...,column1.sd, ...column1.mean,...]
or in fact any column label.