i created a boxplot using ggplot() and geom_boxplot() to display the results of a two-way anova (2x2 between subjects, both factors categorical), but im having trouble reordering the cell groups to my preferred aes() mapping.
here's what ive done so far:
# libraries
library(tidyverse)
library(Rmisc)
# read data
DS = read.csv("....csv")
head(DS)
unique(DS$Binge)
unique(DS$Gender)
# stripchart w box plots
df$f1f2 <- interaction(df$f1, df$f2)
ggplot(DS, aes(x=f1, y=ACC_L, fill=f2)) +
geom_boxplot(position=position_dodge(0.7), width=.6, color='black',
outlier.alpha=FALSE) +
geom_point(position=position_jitterdodge(.2),size=1) +
stat_summary(fun="mean",geom = "point", size=5,
shape=18, position=position_dodge(0.7), color='lightcyan1') +
theme_minimal() +
# Change the axis labels
# ylab("FA") +
xlab("Condition") +
# Make axis labels and tick labels larger
# and change to black
theme( axis.title = element_text(size = 12, color = 'black'),
axis.text = element_text(size = 10, color = 'black'))
I want to reorder the cell groups so that LD-male, LD-female, BD-male, BD-female are displayed in that order.
Thanks in advance,