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.
-roger
_______________________________
UCLA Department of Statistics
[EMAIL PROTECTED]
http://www.stat.ucla.edu/~rpeng
On 18 Mar 2003, Ernesto Jardim wrote:
> 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
>
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help