[R] R syntaxe

2007-02-02 Thread Martin Olivier
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. mean(x[y==1]),...,mean(x[y==30]) I do not want to use an iterative procedure

Re: [R] R syntaxe

2007-02-02 Thread Roland Rau
Hi, On 2/2/07, Martin Olivier [EMAIL PROTECTED] wrote: 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.