clip.column: Clip an integer column

Description Usage Arguments Value Examples

View source: R/clip.column.R

Description

Many count variables in the ACS PUMS data have long upper tails. This function clips integer columns and returns a factor with level names like "1", "2", "3+" that order correctly, even if the clip level is named something like ">=3", which would not sort correctly as a string.

Usage

1
clip.column(x, colname, clip.at, clip.name = NULL)

Arguments

x

a data frame of PUMS data

colname

(string) name of column in x to clip

clip.at

upper clip level

clip.name

(string) name of the top clip level; for clip.at of n, the default is "n+".

Value

factor column with levels like "1", "2", ... "n+" in place of the (count) integer values in x$colname

Examples

1
2
wa.house16$Size <- clip.column(wa.house16, 'NP', 5, '>=5')
group.count(wa.house16, 'HH.Count', 'Size')

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