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)))
Run the code above in your browser using DataLab