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

Ernesto Jardim ernesto at ipimar.pt
Tue Mar 18 18:03:46 CET 2003


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



More information about the R-help mailing list