R/wtcalc.R

Defines functions wtcalc

Documented in wtcalc

#' @rdname internal_desc
#' @export
wtcalc <- function(wtLUT, strvar, acrevar){
  ## DESCRIPTION: Internal function to calculate weights (proportions) by strata.

  strnames <- unique(wtLUT[,strvar])
  stracres <- tapply(wtLUT[,acrevar], wtLUT[,strvar], sum)
  stracres[!(levels(strnames) %in% strnames)] <- 0
  stracres/sum(stracres)
  }

Try the FIESTAutils package in your browser

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

FIESTAutils documentation built on May 29, 2024, 4:06 a.m.