ft_unique_comb {fctutils} | R Documentation |
Create Factor of Unique Combinations from Multiple Factors
Description
Generates a new factor where each level represents a unique combination of levels from the input factors.
Usage
ft_unique_comb(..., sep = "_")
Arguments
... |
Factor vectors to combine. |
sep |
A string to separate levels in the combined factor. Default is |
Value
A factor vector representing unique combinations.
Author(s)
Kai Guo
Examples
# Example factors
factor_vec1 <- factor(c('A', 'A', 'B', 'B'))
factor_vec2 <- factor(c('X', 'Y', 'X', 'Y'))
# Create unique combinations
combined_factor <- ft_unique_comb(factor_vec1, factor_vec2)
levels(combined_factor)
[Package fctutils version 0.0.7 Index]