I am sure this question has been asked before. but I was unable to find anything similiar. So consider a simple worked example
We create random data and then create boxplots:
set.seed(123456)
Ax <- sample(1:3, size = 75, replace = T)
Fac <- sample(LETTERS[1:4], 75, replace = T)
yvalue <- runif(75)
df1 <- data.frame(Ax, Fac, yvalue)
library(ggplot2)
ggplot(df1, aes(factor(Ax), yvalue, colour = Fac)) +
geom_boxplot()
But we review our data closer:
table(df1$Ax, df1$Fac)
I want to create a boxplot plot like the one above, but when the group sizes (n=) is less than 6, then either:
- Do not draw the boxplot at all
- OR only draw a vertical line at the median

