I want to perform multiple Wilcoxon tests. I have 4 columns: R_CO_GC (the values column), TIME_SLOT (6 values), LANE_TYPE (two values), BARRIER_POS (three values: no_barrier, receptor and emisor, but two values for each lane type... for footway: no_barrier and receptor and for roadway: no_barrier and emisor). I want to perform the Wilcoxon test for the following comparisons footway receptor vs footway no_barrier, footway receptor vs roadway emisor, and roadway emisor vs roadway no_barrier for the R_CO_GC variable and to do so for each TIME_SLOT. I want to add those stats to a boxplot graphic that I already have.
I tried to group by LANE_TYPE, BARRIER_POS, and TIME_SLOT to get the different group combinations and then I used the Wilcoxon test function to compare the R_CO_GC values for the different combinations.
stat.test <- lr2_analysis_CO_FIL %>%
filter(BARRIER_POS != 'no_street' & HOLIDAY == 'N' & HOUR >= 6) %>%
group_by(LANE_TYPE, BARRIER_POS, TIME_SLOT) %>%
wilcoxon.test(R_CO_GC ~ BARRIER_POS)
From this code I got this error: Error in wilcox.test.default(., R_CO_GC ~ BARRIER_POS) : 'x' must be numeric
I know that my code is incomplete but I'm testing this piece of code first to see if it's in some way working to keep changing it until I get what I need (maybe I can use a pairwise test function). Sorry, I'm new to R and I don't know how to make this work. I tried with ChatGPT also and It doesn't solve much.