On 12/13/2010 09:04 PM, effeesse wrote:
Hi. In a data set I have a variable that takes values from 1 to 14. For each subgroup of values of this variable, I would like to obtain some descriptive statistics of other variables present in the data set. I've been trying with a "for" loop but I couldn't get nothing. Could you please suggest me some lines?
Hi effeesse, Sure: testmat<-data.frame(sample(1:14,50,TRUE),rnorm(50),runif(50)) by(testmat[,-1],testmat[,1],mean) Jim ______________________________________________ R-help@r-project.org 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.