fct_expand_seq {mark} | R Documentation |
Factor Expand by Sequence
Description
Expands an ordered factor from one level to another
Usage
fct_expand_seq(
x,
min_lvl = min(x, na.rm = TRUE),
max_lvl = max(x, na.rm = TRUE),
by = 1L
)
Arguments
x |
An ordered factor |
min_lvl |
The start of the level sequence |
max_lvl |
The end of the level sequence |
by |
Integer, number of steps in between |
Details
Defaults for min_lvl
and max_lvl
are the minimum and maximum
levels in the ordered vector x
.
Value
An ordered
vector
Examples
x <- ordered(letters[c(5:15, 2)], levels = letters)
fct_expand_seq(x)
fct_expand_seq(x, "g", "s", 3L) # from "g" to "s" by 3
fct_expand_seq(x, "g", "t", 3L) # same as above
# from the first inherit level to the last observed
fct_expand_seq(x, min(levels(x)))
[Package mark version 0.8.0 Index]