haotu : an open lab notebook

2016/03/01

select multiple columns of a data.table by column name

Filed under: Manipulate Data in R, R, R Stats — Tags: , — S @ 12:39
myDT[,.(mycolname1,mycolname2,mycolname3)]
Advertisements

2015/01/30

aggregate more than one column in data.table

Filed under: R — Tags: , , , , — S @ 11:15
# Average ability by grade
agg1<- fm1[, j=list(mean(x0, na.rm = TRUE),mean(x1, na.rm = TRUE)),by = key]

http://rprogramming.net/aggregate-data-in-r-using-data-table/

Blog at WordPress.com.