Stavros Macrakis <macrakis <at> alum.mit.edu> writes:

> 
> Some minor improvements and corrections below
> 
> # Simple weighted quantile
> #
> # v  A vector of sortable observations
> # w A numeric vector of positive weights
> # p  The quantile 0<=p<=1
> #
> # Nothing fancy: no interpolation etc.; NA cases not thought through
> 
>  wquantile <- function(v,w=rep(1,length(v)),p=.5)

You could compare it with wtd.quantile in Hmisc.

Dieter

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to