library(ggplot2) # needed for the mpg data frame
library(dplyr) # needed for data wrangling
mpg %>% group_by(drv) %>%
summarise(median_cty = median(cty)) %>%
lollipopChart(
x = "drv",
y = "median_cty",
sort = "ascending",
xtitle = "drv variable",
ytitle = "median cty",
title = "Median cty per drv"
)
Run the code above in your browser using DataLab