Re: [R] basic problem but can't solve it

2007-05-23 Thread Christophe Pallier
If I understood correctly, the initial post asked for a vector of the same length as the original one. This is why I suggested: tapply(Measure,Month,mean)[as.character(Month)] btw, this is handy way to compute deviations from the means of subgroups (x - tapply(x, group,

Re: [R] basic problem but can't solve it

2007-05-23 Thread Gabor Grothendieck
Use ave. Assuming DF is your 2 column data frame: ave(DF[,1], DF[,2], FUN = mean) On 5/22/07, Benoit Chemineau [EMAIL PROTECTED] wrote: Hello, I have a basic problem but i can't figure it out with the table underneath. I would like to compute monthly averages. I would like to have the

[R] basic problem but can't solve it

2007-05-22 Thread Benoit Chemineau
Hello, I have a basic problem but i can't figure it out with the table underneath. I would like to compute monthly averages. I would like to have the average measure for month #5 for the first three rows (the same number in the first three lines) and the average measure for month #6 for the

Re: [R] basic problem but can't solve it

2007-05-22 Thread Cody_Hamilton
] at.math.ethz.ch Subject [R] basic problem but can't solve it 05/22/2007 10:01

Re: [R] basic problem but can't solve it

2007-05-22 Thread Gavin Simpson
On Tue, 2007-05-22 at 19:01 +0200, Benoit Chemineau wrote: Hello, I have a basic problem but i can't figure it out with the table underneath. I would like to compute monthly averages. I would like to have the average measure for month #5 for the first three rows (the same number in the

Re: [R] basic problem but can't solve it

2007-05-22 Thread Christophe Pallier
tapply(Measure,Month,mean)[as.character(Month)] -- Christophe Pallier (http://www.pallier.org) On 5/22/07, Benoit Chemineau [EMAIL PROTECTED] wrote: Hello, I have a basic problem but i can't figure it out with the table underneath. I would like to compute monthly averages. I would

Re: [R] basic problem but can't solve it

2007-05-22 Thread John Kane
aggregate(Measure, list(Month=Month), mean) --- Benoit Chemineau [EMAIL PROTECTED] wrote: Hello, I have a basic problem but i can't figure it out with the table underneath. I would like to compute monthly averages. I would like to have the average measure for month #5 for the first