Вы можете указать порядок факторов с помощью аргумента 'levels' в функции factor ().
#days column is by default ordered alpabetically
data <- data.frame(days = c(rep("Monday", 20),
rep("Tuesday", 20),
rep("Wednesday", 20),
rep("Thursday", 20)),
value = c( sample(2:5, 20 , replace=T) , sample(6:10, 20 , replace=T),
sample(1:7, 20 , replace=T), sample(3:10, 20 , replace=T) ))
boxplot(data$value ~ data$days)
#change order with 'factor()' and specify order with 'levels' argument
data$days <- factor(data$days, levels = c("Monday", "Tuesday", "Wednesday", "Thursday"))
boxplot(data$value ~ data$days)