Hy Katie,
There are many ways to do this. A simple one is to create a vector of
the same length than your 'x' vector, containing a group label.
> group=rep(c(1,2,3),times=nr[1,])
Then you can use tapply to apply a function (in this case mean and
variance) of the values of x within each group
kathie wrote:
> Dear R users,
>
> I have 32 observations in data x. After sorting this, I want to compute
> means and variances of 3 groups divided by "nr".
>
> Actually, the number of groups is flexible. Any suggestion will be greatly
> appreciated.
>
Hi Kathryn,
One way (there are many oth
Dear R users,
I have 32 observations in data x. After sorting this, I want to compute
means and variances of 3 groups divided by "nr".
Actually, the number of groups is flexible. Any suggestion will be greatly
appreciated.
Kathryn Lord
--
3 matches
Mail list logo