sort_factor | R Documentation |
Set factor with sorted ascending unique values as levels. Also allows the user to explicitly set the reference level.
sort_factor(var, base.level = NULL, ...)
var |
Vector to convert to factor. |
base.level |
Reference level as a character string. Optional argument. |
... |
Additional arguments to pass to |
A factor with levels in ascending order and a potential user-defined reference level.
no_ref <- sort_factor(c("e", "f", "z", "d", "a")) with_ref <- sort_factor(c("e", "f", "z", "d", "a"), base.level = "z") levels(no_ref) levels(with_ref)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.