I feel like I'm missing something very basic but any advice is appreciated.
I have a large dataset with 19 variables, both categorical and numerical. I want to produce a plot with three of the variables (since they share a unit) averaged and arranged by factor. Fake sample data:
Sex Low Freq High Freq Bandwidth
M 3000 4011 1011
M 3000 3600 600
M 2790 4237 1447
F 2700 3300 500
F 2900 4517 617
F 2813 3857 1044
I have tried:
ggplot(TripleSongAverages, aes(x=factor(Sex), y='Low Freq', 'High Freq', 'Bandwidth')) + stat_summary(fun.y="mean", geom="bar")
But that only produces a plot with the first variable.
I would suggest using a
tidyverse
approach reshaping the data and computing mean values. Here the code:Code:
Output: