def_prep: Prepare dictionary structure from a data frame with columns...

Description Usage Arguments Value Examples

View source: R/prep-dictionary.R

Description

value map will be applied only when starting_value and ending_value are same to do this, convert it into a nested list ... list will have elements for columns in pums_hh, each one a named vector of potential values

Usage

1
2
3
4
5
6
7
def_prep(
  definitions_tbl,
  variable_col,
  value_col,
  definition_col,
  drop_solos = TRUE
)

Arguments

definitions_tbl

A data frame containing information about the definitions of values stored in another table.

variable_col

Unquoted name of column in 'definitions_tbl' that identifies columns in the data table being cleaned

value_col

Unquoted name of column in 'definitions_tbl' that stores current values of variables identified by 'variable_col'

definition_col

Unquoted name of column in 'definitions_tbl' that stores replacement / "definition" values matched to 'value_col'

drop_solos

Optionally, logical identifying whether to exclude variables from the dictionary if they only have one unique value

Value

Named list of vectors to use for recoding variables. Probably should be an S3 class.

Examples

1
2
3
4
tibble::tibble(variable   = c("A", "A", "B", "B", "C"),
               value      = c(1,   2,   1,   2,   1),
               definition = c("cat", "dog", "fred", "george", "lonely")) %>%
  def_prep(variable, value, definition)

davisadamw/definer documentation built on March 11, 2020, 4:14 a.m.