set_col_as_character {dataPreparation}R Documentation

Set columns as character

Description

Set as character a column (or a list of columns) from a data.table.

Usage

set_col_as_character(data_set, cols = "auto", verbose = TRUE)

Arguments

data_set

Matrix, data.frame or data.table

cols

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

verbose

Should the function log (logical, default to TRUE)

Value

data_set (as a data.table), with specified columns set as character.

Examples

# Build a fake data.frame
data_set <- data.frame(numCol = c(1, 2, 3), factorCol = as.factor(c("a", "b", "c")))

# Set numCol and factorCol as character
data_set <- set_col_as_character(data_set, cols = c("numCol", "factorCol"))

[Package dataPreparation version 1.0.4 Index]