How can I format a faceted, multi-grouped box plot's x axes so that I get something that looks like this (dodgy paint, but shows the idea)...
Here's the code so far.
# Make the dataset
data<-data.frame(cbind(runif(10,1,10),
sample(1:5, 10, replace=TRUE),
sample(1:5, 10, replace=TRUE),
sample(1:2, 10, replace=TRUE),
sample(1:2, 10, replace=TRUE)))
names(data)<-c("DV","Grouping_1", "Grouping_2", "Grouping_3", "Grouping_4")
data$Grouping_1<-as.factor(data$Grouping_1)
data$Grouping_2<-as.factor(data$Grouping_2)
data$Grouping_3<-as.factor(data$Grouping_3)
data$Grouping_4<-as.factor(data$Grouping_4)
# grab the interaction
data$groups<-interaction(data$Grouping_1,data$Grouping_2)
# Sort it (to make things neat)
data$groups<-factor(data$groups, levels = sort(levels(data$group)))
# Plot it
ggplot(data = data, aes(x =groups, y = DV, fill = Grouping_3)) +
geom_bar(stat = "identity", position = position_dodge()) + facet_grid(Grouping_4 ~ .)
Which gives...