I want to merge the three datasets grouped and obtain a graph with only two boxes, 1 for A and 1 for B. Can you suggest how to get that?
I\'m tryng to create a group
Using base R, I think @r2evans solution is the best. However, an easier fix to the code in the question is by using the option xaxt="n"
:
boxplot(DF, col = rainbow(3, s = 0.5), at = c(1:3,5:7), xaxt = "n")
axis(side = 1, at = c(2,6), labels = c("A","B"))
legend("topleft", fill = rainbow(3, s = 0.5), legend = c(1,2,3), horiz = T)
This adds more flexibility in formatting the axis.