0

Environment: R Console RMySQL ggplot2

I connected my mysql table and have this as an output

Category Dataset1 Dataset2
A 30 60
B 70 40

enter image description here

I am having difficulties trying to understand how I can get ggplot to output a grouped bar chart similar to

enter image description here

I tried following the instructions at https://r-graph-gallery.com/48-grouped-barplot-with-ggplot2 > Grouped barchart but I can't seem to wrap my head around how it's supposed to be configured.

Norman D
  • 13
  • 2
  • 3
    ggplot2 is going to prefer the data in "long" format, see https://stackoverflow.com/q/2185252/3358272, https://stackoverflow.com/q/68058000/3358272; from there, see https://stackoverflow.com/q/12018499/3358272, https://stackoverflow.com/q/6455088/3358272; two-categ-vars https://stackoverflow.com/q/74636143/3358272 for good discussions on ggplot2 and grouped bar plots. – r2evans May 10 '23 at 15:09
  • 1
    Thank you for the directions! Am new to ggplot and the links above helped to provide context on how to structure data : ) – Norman D May 10 '23 at 15:36

0 Answers0