Errors with ggbetweenstats

Hi there, I have a problem with plotting this box plot using ggbetweenstats. Below is a screenshot of 'count data', and as you can see, the columns and rows are all the same lengths and I'm not sure why whenever I run the code, it gives the error:
"Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 0, 1"
"Error in plot + ylim(0, 12) + plot_annotation(title = "Farm A", theme = theme(plot.title = element_text(color = "#292929", :
non-numeric argument to binary operator:"

The code seems to work if I insert other datasets, but not with this (and a few other select) dataset(s).

Screen Shot 2021-09-08 at 1.23.08 PM

countdata$group=factor(countdata$group, levels =col)
plot=ggbetweenstats(data=countdata,x=group,y=RES,xlab="Growing Stages",ylab="Antibiogram length",
                    pairwise.comparisons = TRUE,p.adjust.method = "fdr", ggtheme = ggplot2::theme_gray())
plot+ylim(0, 12)+
  plot_annotation(title= "Farm A", 
                  theme=theme(plot.title = element_text(color="#292929",size= 22,face="bold",family="Arial Black",hjust = 0.5),
                              plot.background = element_rect("white"),
                              panel.background = element_rect("white")))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.