makeKeylist: Convert the variable key into a list of long keys, one for...

View source: R/variableKey.R

makeKeylistR Documentation

Convert the variable key into a list of long keys, one for each variable.

Description

A keylist element is a long key for one new variable. The new variables are named by "name_old.name_new" for uniqueness.

Usage

makeKeylist(
  key,
  sep = c(character = "\\|", logical = "\\|", integer = "\\|", factor = "\\|",
    ordered = "[\\|<]", numeric = "\\|"),
  na.strings = c("\\.", "", "\\s+", "N/A")
)

Arguments

key

A key object or a file name, csv, xlsx or rds.

sep

Separator regular expressions

na.strings

Strings that will be treated as NA. This will be used only if the key object does not have an na.strings attribute.

Details

If the key has one old variable being recoded 6 ways, that begets 6 elements in the resulting list. Attributes including the classes of the old and new variables are included.

Value

A list with one element per variable name, along with some attributes like class_old and class_new. The class is set as well, "keylist"

Author(s)

Paul Johnson <pauljohn@ku.edu>


kutils documentation built on Sept. 17, 2023, 5:06 p.m.