generate_from_character {dataPreparation}R Documentation

Recode character

Description

Recode character into 3 new columns:

Usage

generate_from_character(
  data_set,
  cols = "auto",
  verbose = TRUE,
  drop = FALSE,
  ...
)

Arguments

data_set

Matrix, data.frame or data.table

cols

List of character column(s) name(s) of data_set to transform. To transform all characters, set it to "auto". (character, default to "auto")

verbose

Should the function log (logical, default to TRUE)

drop

Should cols be dropped after generation (logical, default to FALSE)

...

Other arguments such as name_separator to separate words in new columns names (character, default to ".")

Value

data_set with new columns. data_set is edited by reference.

Examples

# Load data set
data(messy_adult)
messy_adult <- un_factor(messy_adult, verbose = FALSE) # un factor ugly factors

# transform column "mail"
messy_adult <- generate_from_character(messy_adult, cols = "mail")
head(messy_adult)

# To transform all characters columns:
messy_adult <- generate_from_character(messy_adult, cols = "auto")

[Package dataPreparation version 1.0.4 Index]