Below is an example of my dataset:
structure(list(wheezing_InDMod = c(0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0), cough_anyMod = c(0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0), SOB_anyMod = c(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), country.x = c("cameroon",
"cameroon", "cameroon", "kenya", "cameroon", "ghana", "cameroon",
"kenya", "cameroon", "kenya", "cameroon", "cameroon", "cameroon",
"cameroon", "cameroon", "cameroon", "cameroon", "cameroon", "ghana",
"cameroon", "kenya", "cameroon", "ghana", "cameroon", "cameroon",
"cameroon")), row.names = 65:90, class = "data.frame")
For wheezing_InDMod
, SOB_anyMod
& cough_anyMod
, 1 indicates that this individual has the symptom and 0 indicates they do not
I'm trying to plot a single bargraph showing the prevalence of each symptom [ e.g. "1" for wheezing_InDMod
, SOB_anyMod
& cough_anyMod
] on the X axis, with each further split into 3 adjacent bars based on the country.x
category. I'll attach an image below to show an idea of what I mean:
Does anyone know how I would go about creating this using ggplot? I've tried a few different codes and I haven't got very far