A nice way to obtain summary for data is to use summary.formula in Hmisc 
package.

 Justin BEM
BP 1917 Yaoundé
Tél (237) 76043774




________________________________
De : Jim Lemon <j...@bitwrit.com.au>
À : effeesse <scarpin...@gmail.com>
Cc : r-help@r-project.org
Envoyé le : Lun 13 décembre 2010, 11h 23min 15s
Objet : Re: [R] descriptive statistics

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.



      
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to