Good afternoon R experts,
I am in the process of making a fairly involved bar-chart in R, and I am having a difficult time reorganizing the clusters in my graph. Specifically, all of the control and lesion values are clustered separately as shown below:
Instead of the Control and Lesion conditions being clustered separately in each facet, I want them to be side-by-side per each paper and task. This should cause the Control and Lesion labels to be repeated many times over, and I cannot figure out how to do this. My code that I used to achieve this bar graph is below:
p10 <- ggplot(cbmeta_new1,
aes(x = Condition, y = Proportion, fill = Task, alpha = Paper)) +
geom_bar(stat = 'identity', position = 'dodge', colour='black') +
facet_grid(~ Type) +
scale_alpha_discrete()
Can someone please advise as to how I can edit the above script to achieve the desired formatting? Thank you in advance for your time and consideration!
Here is some example data:
dput(cbmeta_new[1:10, ])
structure(list(Paper = structure(c(1L, 2L, 2L, 2L, 2L, 4L, 5L,
3L, 3L, 6L), .Label = c("Cattaneo et al., 2012", "Clausi et al.,
2019",
"Gerschcovich et al., 2011", "Hoche et al., 2016", "Roca et al.,
2013",
"van Harskamp et al., 2005", "van Overwalle et al., 2019"), class =
"factor"),
Type = structure(c(2L, 1L, 3L, 4L, 4L, 1L, 4L, 1L, 4L, 4L
), .Label = c("Perceptual", "Sequencing", "Emotion Attribution",
"Verbal Vignette", "Other"), class = "factor"), Task = structure(c(1L,
9L, 3L, 5L, 12L, 9L, 5L, 9L, 5L, 12L), .Label = c("Bio Action Obs",
"Causal Attribution", "Emot Attribution", "False Belief",
"Faux Pas", "Gravity", "Mechanical", "Norm Behavior", "RMET",
"Sequencing", "Social Script", "ToM", "Trait Attribution",
"Violations"), class = "factor"), Condition = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Control",
"Lesion"), class = "factor"), Proportion = c(0.8875, 0.73,
0.71, 0.78, 0.95, 0.7632, 0.91, 0.829444444, 0.95, 0.986428571
)), row.names = c(NA, 10L), class = "data.frame")
I apologize, I'm new to this site and still navigating how to best make these posts.
Kind regards, Linda