Hi, i have many variables for in example 4weeks and want to do aggregations, like mean standard , deviation etc..
With mean it works but how i can calculate the standard deviation for the 4weeks and for every ID. many thanks & regards, christian week1 <- grep("(_PRO_001)",names(dmx3),perl=T) week1table <- subset(dmx3,select=c(ID,week1)) week2 <- grep("(_PRO_002)",names(dmx3),perl=T) week2table <- subset(dmx3,select=c(ID,week2)) week3 <- grep("(_PRO_003)",names(dmx3),perl=T) week3table <- subset(dmx3,select=c(ID,week3)) week4 <- grep("(_PRO_004)",names(dmx3),perl=T) week4table <- subset(dmx3,select=c(ID,week4)) mws <- (week1table[,2:117]+week2table[,2:117]+week3table[,2:117]+week4table[,2:117])/4 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.