# revfactorlevels.R
# ::rtemis::
# 2022 E.D. Gennatas www.lambdamd.org
#' Reverse factor level order
#'
#' @param x factor
#'
#' @export
#' @author E.D. Gennatas
revfactorlevels <- function(x) {
if (is.factor(x)) {
factor(x, levels = rev(levels(x)))
} else {
x
}
} # rtemis::revfactorlevels
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.