Orders the levels of a likelihood category factor
order_likelihood_levels(x)a factor with ordered levels
Other likelihood functions:
get_likelihood_category(),
simplify_likelihood_levels()
if (FALSE) { # \dontrun{
library(ggplot2)
library(tibble)
trends <- tribble(
~ trend, ~n,
"Indeterminate", 2,
"Very likely worsening", 3,
"Likely improving", 2)
# unordered plot
qplot(trend, n, fill = trend, data = trends, geom = "col")
ordered_trends <- dplyr::mutate(trends,
trend = order_likelihood_levels(trend))
# nice ordered plot
qplot(trend, n, fill = trend, data = ordered_trends, geom = "col")
} # }