ggbarstats returns an error for factor variables with more levels than the palette vector. In previous versions, the plot was produced with a warning; now it fails with an error.
The following code returns the error "Error in vec_slice() at ggplot2/R/scale-.R:1330:5:
! Can't subset elements past the end.
ℹ Locations 10, 11, 12, …, 24, and 25 don't exist.
ℹ There are only 9 elements."
data("mtcars")
library("dplyr")
ggstatsplot::ggbarstats(mtcars %>% mutate(mpg = factor(mpg)),
"mpg",
"vs")