Learn R Programming

dataPreparation (version 0.4.3)

setColAsCharacter: Set columns as character

Description

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

Usage

setColAsCharacter(dataSet, cols = "auto", verbose = TRUE)

Arguments

dataSet

Matrix, data.frame or data.table

cols

List of column(s) name(s) of dataSet 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

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

Examples

Run this code
# NOT RUN {
# Build a fake data.frame
dataSet <- data.frame(numCol = c(1, 2, 3), factorCol = as.factor(c("a", "b", "c")))

# Set numCol and factorCol as character
dataSet <- setColAsCharacter(dataSet, cols = c("numCol", "factorCol"))
# }

Run the code above in your browser using DataLab