R/discrep.factor.R

discrep.factor <-
function(datavec, targetvec, weightvec) {
    dat <- sapply(names(targetvec), function(x) {
        sum(weightvec[datavec == x & !is.na(datavec)])/sum(weightvec[!is.na(datavec)])
    })
    out <- targetvec - dat
    out
}

Try the anesrake package in your browser

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

anesrake documentation built on May 2, 2019, 1:42 p.m.