# NOT RUN {
library(dplyr)
plot_data <- ggplot2::diamonds %>%
mutate(cut = stringr::str_to_sentence(cut)) %>%
group_by(cut, clarity) %>%
summarise(average_price = mean(price)) %>%
mutate(average_price = round(average_price / 1000, 1))
ggplot_hbar_facet(plot_data, average_price, cut, clarity,
title = "Average diamond price by cut and clarity",
x_title = "Average price ($US thousands)",
y_title = "Cut")
# }
Run the code above in your browser using DataLab