[R] R syntaxe

Martin Olivier martinol at ensam.inra.fr
Fri Feb 2 17:53:10 CET 2007

Hi all,

Suppose I have a vector x with numerical values.
In y, I have a categorial variable : y<-c(1,1,..2,2,...30,30,30)
x and y have the same length.
I would like to compute the mean for x for the modality 1 to 30 in y.
I do not want to use an iterative procedure such that for (i in 1:30)..
Thanks for your help,



Martin Olivier
INRA - Unité Biostatistique & Processus Spatiaux
Domaine St Paul, Site Agroparc
84914 Avignon Cedex 9, France
Tel : 04 32 72 21 57

More information about the R-help mailing list