zap_ipums_attributes: Remove all IPUMS attributes from a variable (or all variables...

View source: R/lbl_helpers.r

zap_ipums_attributesR Documentation

Remove all IPUMS attributes from a variable (or all variables in a data.frame)

Description

Helper to remove ipums attributes (including value labels from the labelled class, the variable label and the variable description). These attributes can sometimes get in the way of functions like the dplyr join functions so you may want to remove them.

Usage

zap_ipums_attributes(x)

Arguments

x

A variable or a whole data.frame to remove attributes from

Value

A variable or data.frame

See Also

Other lbl_helpers: lbl_add(), lbl_clean(), lbl_collapse(), lbl_define(), lbl_na_if(), lbl_relabel(), lbl()

Examples

cps <- read_ipums_micro(ipums_example("cps_00006.xml"))
annual_unemployment <- data.frame(YEAR = c(1962, 1963), unemp = c(5.5, 5.7))

# Avoids warning 'Column `YEAR` has different attributes on LHS and RHS of join'
cps$YEAR <- zap_ipums_attributes(cps$YEAR)
cps <- dplyr::left_join(cps, annual_unemployment, by = "YEAR")


ipumsr documentation built on Sept. 30, 2022, 9:05 a.m.