group.median: Compute weighted median of numerical column on grouped ACS...

Description Usage Arguments Value Examples

View source: R/group.median.R

Description

Collect point estimate, standard error and 90 the median of med.var across groups defined by gp.var and over the whole data.

Usage

1
2
group.median(x, gp.var, med.var, result.name = "Median",
  drop.na.group = TRUE)

Arguments

x

a data frame of PUMS data. If x is already grouped, then this function optionally adds a level to the grouping.

gp.var

name of variable in x to group data by (string) or NULL if x is grouped and you do not want to add a level of grouping. May not be NULL if x is not grouped.

med.var

(string) name of a numerical column in x to take median over

result.name

name of estimate column in result. Default is 'Median'

drop.na.group

drop the group where gp.var is NA; default TRUE

Value

data frame of median, standard error of the median, and the margin of error of the median of med.var over the groups defined by gp.var and for the whole data.

Examples

1
2
3
# Median income by tenure type for Washington State in 2016
group.median(wa.house16, 'TEN', 'HINCP', result.name='Med.HH.Inc',
             drop.na.group=TRUE)

davidthaler/PUMSutils documentation built on July 13, 2019, 9:58 a.m.