# \dontshow{
set.seed(1)
# }
f <- factor(sample(letters[1:5], 100, replace = TRUE))
# the reference level
ref_level(f)
# a specific level
level(f, level = "b")
# note that the levels will always match the input factor
identical(levels(f), levels(ref_level(f)))
identical(levels(f), levels(level(f, "c")))
Run the code above in your browser using DataLab