R/r.is.R

Defines functions r.is

Documented in r.is

r.is <-
function(x, weight, p){
  n <- length(x)
  if (is.null(weight)) weight <- rep(1, n)
    q.p <- rep(weighted.quantile(x, weight, c(p)), length(x))
    ind <- ifelse(x > q.p, 1, 0)
    r.2 <- sum(x*weight*ind)/sum(x*weight)
  return(r.2)
}

Try the affluenceIndex package in your browser

Any scripts or data that you put into this service are public.

affluenceIndex documentation built on Jan. 5, 2022, 5:07 p.m.