group.mean: Compute weighted mean of numerical column on grouped ACS PUMS...

Description Usage Arguments Value Examples

View source: R/group.mean.R

Description

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

Usage

1
group.mean(x, gp.var, mean.var, result.name = "Mean", 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.

mean.var

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

result.name

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

drop.na.group

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

Value

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

Examples

1
2
# Average household size by tenure for Washington State in 2016
group.mean(wa.house16, 'TEN', 'NP', result.name='Mean.HH.Size', drop.na.group=TRUE)

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