tt_fix: Find and replace metadata in an existing translation table

Description Usage Arguments Author(s)

View source: R/tt_fix.R

Description

Use "find" arguments to identify a string of text to be overwritten with "replace" arguments in a variable name, label, output codes, output labels, universe statements, or manual recode fields. If "replace" arguments are provided without corresponding "find" arguments, the full text of each value will be replaced (except for output codes and output labels, which cannot be disambiguated automatically).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
tt_fix(
  path_or_variable,
  name_find,
  name_replace,
  label_find,
  label_replace,
  output_find,
  output_replace,
  univ_find,
  univ_replace,
  manual_recode,
  write = T
)

Arguments

path_or_variable

Character: Either a full path to a translation table or the variable name associated with a translation table currently in the PMA variables folder

name_find

Optional character: a string in the existing variable name

name_replace

Optional character: a string to replace name_find. If name_find is not provided, name_replace will replace the entire variable name. The new file will be renamed accordingly.

label_find

Optional character: a string in the existing variable label

label_replace

Optional character: a string to replace label_find. If label_find is not provided, label_replace will replace the entire variable label.

output_find

Optional character: a string in the existing output codes or output labels

output_replace

Optional character: a string to replace output_find. If no output_find is provided, no replacement will be made. If an output code is changed, the all rows in the tt block will be re-sorted in ascending order with the new output code included.

univ_find

Optional character: a string in the existing block of universe statements

univ_replace

Optional character: a string to replace univ_find. If no univ_find to provided, all samples in the universe block will be assigned the same universe statement in univ_replace.

manual_recode

Optional character: a string to replace the manual recode value for all samples (usually "2", "1", or empty "")

write

Logical: Defaults TRUE. If FALSE, the translation table will be returned as a tibble and not written.

Author(s)

Matt Gunther


mgunther87/ipumsPMA documentation built on Aug. 1, 2020, 12:22 a.m.