powered by
Takes in variable and finds median, works with sampling weights. Makes use of the wtd.quantile function, part of the Hmisc package.
wtd.median(x, w = NULL, data, ...)
Returns the median value of the variable
A variable
(Optional) Sampling weights of variable
(Optional) Name of dataset that contains x (and w) variable
library(RCPA3) wtd.median(x=nes$approve.pres.hc, w=nes$wt) wtd.median(x=nes$approve.pres.hc)
Run the code above in your browser using DataLab