Learn R Programming

poliscidata (version 2.3.0)

wtd.median: Find Median of Variable

Description

Takes in variable and finds median, works with sampling weights

Usage

wtd.median(x, weights = NULL)

Arguments

x

A variable

weights

Sampling weights of variable (optional)

Value

Returns the median value of the variable

Details

Makes use of the wtd.quantile function, part of the Hmisc package

Examples

Run this code
# NOT RUN {
   library(poliscidata)
   
   wtd.median(nes$budget_deficit_x, nes$wt)
# }

Run the code above in your browser using DataLab