ft_factorize {fctutils} | R Documentation |
Factorize Character Vectors with Consistent Levels
Description
Converts one or more character vectors into factors, ensuring that they share the same levels.
Usage
ft_factorize(..., levels = NULL)
Arguments
... |
Character vectors to factorize. |
levels |
An optional character vector specifying the levels. If |
Value
A list of factor vectors with consistent levels.
Author(s)
Kai Guo
Examples
# Example character vectors
vec1 <- c('apple', 'banana', 'cherry')
vec2 <- c('banana', 'date', 'apple')
# Factorize with consistent levels
factors <- ft_factorize(vec1, vec2)
levels(factors[[1]])
levels(factors[[2]])
[Package fctutils version 0.0.7 Index]