Show the code
library(ggplot2) # beautiful graphs
library(tidyr) # tidy dataAndy Grogan-Kaylor
July 1, 2022
pivot_longer# A tibble: 6 × 3
x newnames newvalues
<dbl> <chr> <dbl>
1 1 y 4
2 1 z 7
3 2 y 5
4 2 z 8
5 3 y 6
6 3 z 3
geom_bar()geom_col()By default, geom_col() assumes stat = 'identity' i.e. y is the height of the bar.