[R] weighted.mean and na.rm=T in R-1.6.2

2003-03-18 Thread Ernesto Jardim
Hi It looks like the na.rm flag is not working in function weighted.mean. weighted.mean(mat95$U,mat95$fpanual) [1] NA weighted.mean(mat95$U,mat95$fpanual,na.rm=TRUE) [1] NA mat95 - mat95[!is.na(mat95$fpanual),] weighted.mean(mat95$U,mat95$fpanual) [1] 14.93259 Regards EJ

Re: [R] weighted.mean and na.rm=T in R-1.6.2

2003-03-18 Thread Ernesto Jardim
On Tue, 2003-03-18 at 17:36, Roger Peng wrote: It seems you have NA's in the weights. But from ?weighted.mean: Details: If `w' is missing then all elements of `x' are given the same weight. Missing values in `w' are not handled. Here, `w' is the vector of weights.