Learn R Programming

forcats (version 0.0.0.9000)

fct_expand: Add additional levels to a factor

Description

Add additional levels to a factor

Usage

fct_expand(f, ...)

Arguments

f
A factor.
...
Additional levels to add to the factor. Levels that already exist will be silently ignored.

Examples

Run this code
f <- factor(sample(letters[1:3], 20, replace = TRUE))
f
fct_expand(f, "d", "e", "f")
fct_expand(f, letters[1:6])

Run the code above in your browser using DataLab