Orders the levels of a likelihood category factor
order_likelihood_levels(x)
x | the unordered factor. Levels must be one of those found in er.helpers:::likelihood_terms |
---|
a factor with ordered levels
Other likelihood functions:
get_likelihood_category()
,
simplify_likelihood_levels()
if (FALSE) { 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") }