set_factor {mltools} | R Documentation |
Set Factor
Description
Convience method for dealing with factors. Map a list of vectors to a list of factor vectors (1-1 mapping) such that the factor vectors all have the same levels - the unique values of the union of all the vectors in the list. Optionally group all low frequency values into a "_other_" level.
Usage
set_factor(vectorList, aggregationThreshold = 0)
Arguments
vectorList |
A list of values to convert to factors |
aggregationThreshold |
Values which appear this many times or less will be grouped into the level "_other_" |
Examples
x <- c("a", "b", "c", "c")
y <- c("a", "d", "d")
set_factor(list(x, y))
set_factor(list(x, y), aggregationThreshold=1)
[Package mltools version 0.3.5 Index]