[R] tapply and weighted means

2006-01-12 Thread Florent Bresson
I' m trying to compute weighted mean on different groups but it only returns NA. If I use the following data.frame truc: x y w 1 1 1 1 2 2 1 3 1 1 4 2 0 2 1 0 3 2 0 4 1 0 5 1 where x is a factor, and then use the command : tapply(truc$y,list(truc$x),wtd.mean, weights=truc$w)

Re: [R] tapply and weighted means

2006-01-12 Thread Dimitris Rizopoulos
: Thursday, January 12, 2006 3:44 PM Subject: [R] tapply and weighted means I' m trying to compute weighted mean on different groups but it only returns NA. If I use the following data.frame truc: x y w 1 1 1 1 2 2 1 3 1 1 4 2 0 2 1 0 3 2 0 4 1 0 5 1 where x

Re: [R] tapply and weighted means

2006-01-12 Thread Frank E Harrell Jr
/~m0390867/dimitris.htm - Original Message - From: Florent Bresson [EMAIL PROTECTED] To: R-help r-help@stat.math.ethz.ch Sent: Thursday, January 12, 2006 3:44 PM Subject: [R] tapply and weighted means I' m trying to compute weighted mean on different groups but it only returns

Re: [R] tapply and weighted means

2006-01-12 Thread Gavin Simpson
On Thu, 2006-01-12 at 15:44 +0100, Florent Bresson wrote: I' m trying to compute weighted mean on different groups but it only returns NA. If I use the following data.frame truc: x y w 1 1 1 1 2 2 1 3 1 1 4 2 0 2 1 0 3 2 0 4 1 0 5 1 where x is a factor, and then