wtd.median: Find Median of Variable with Option to Weight Observations

View source: R/helper.functions.r

wtd.medianR Documentation

Find Median of Variable with Option to Weight Observations

Description

Takes in variable and finds median, works with sampling weights. Makes use of the wtd.quantile function, part of the Hmisc package.

Usage

wtd.median(x, w = NULL, data, ...)

Arguments

x

A variable

w

(Optional) Sampling weights of variable

data

(Optional) Name of dataset that contains x (and w) variable

Value

Returns the median value of the variable

Examples

   library(RCPA3)
   
   wtd.median(x=nes$approve.pres.hc, w=nes$wt)
   wtd.median(x=nes$approve.pres.hc)

RCPA3 documentation built on May 29, 2024, 12:19 p.m.

Related to wtd.median in RCPA3...