Learn R Programming

MLmorph (version 0.1.1)

factorize_character_vector: Turn character vector into a factor

Description

Turn character vector into a factor

Usage

factorize_character_vector(data_vector, custom_labels = NULL)

Value

A factor with labeled levels.

Arguments

data_vector

Character vector.

custom_labels

Optional named character vector where names are original values and values are labels.

Examples

Run this code
factorize_character_vector(c("A First", "B Second", "C Third"))

Run the code above in your browser using DataLab