I am trying to plot my ANOVA results on boxplot per group per time but I receive the following error message: non-numeric argument to binary operator.
I started with R not so long ago and I can't figure out what's the problem.
All the df is complete
Levene test ok
Barlett test ok
Any help would be very appreciated thanks.
Test and plot
# Test
res.aov_totalcholesterol <- anova_test(
data = final_clean_low_MV_totalcholesterol, dv = totalcholesterol, wid = id,
between = group, within = time
)
get_anova_table(res.aov_glucose)
# Post-hoc tests
# Effect of group at each time point (group has an effect pre intervention)
one.way_totalcholesterol <- final_clean_low_MV_totalcholesterol%>%
group_by(time) %>%
anova_test(dv = totalcholesterol, wid = id, between = group) %>%
get_anova_table() %>%
adjust_pvalue(method = "bonferroni")
one.way_totalcholesterol
# Pairwise comparisons between group levels and time
pwc_totalcholesterol <- final_clean_low_MV_totalcholesterol%>%
group_by(time) %>%
pairwise_t_test(totalcholesterol ~ group, p.adjust.method = "bonferroni")
pwc_totalcholesterol
## Effect of time in each group
one.way2_totalcholesterol <- final_clean_low_MV_totalcholesterol %>%
group_by(group) %>%
anova_test(dv = totalcholesterol, wid = id, within = time) %>%
get_anova_table() %>%
adjust_pvalue(method = "bonferroni")
one.way2_totalcholesterol
library(ggpubr)
# Plots ERROR MESSAGE: non-numeric argument to binary operator
pwc <- pwc_totalcholesterol %>% add_xy_position(x = "time")
pwc.filtered <- pwc %>% filter(time != "t1")
bxp +
stat_pvalue_manual(pwc.filtered, tip.length = 0, hide.ns = TRUE) + labs(subtitle = get_test_label(res.aov_totalcholesterol, detailed = TRUE),
caption = get_pwc_label(pwc_totalcholesterol))
Reproducible df
final_clean_low_MV_totalcholesterol<-structure(list(id = structure(c("SA01", "SA02", "SA03", "SA04",
"SA05", "SA06", "SA07", "SA08", "SA09", "SA10", "SA11", "SA12",
"SA13", "SA14", "SA15", "SA16", "SA17", "SA18", "SA19", "SA20",
"SA21", "SA22", "SA23", "SA24", "SA25", "SA26", "SA27", "SA28",
"SA29", "SA30", "SA31", "SA32", "SA33", "SA34", "SA35", "SA36",
"SA37", "SA38", "SA39", "SA40", "SA41", "SA42", "SA43", "SA44",
"SA45", "SA46", "SA47", "SA48", "SA49", "SA50", "SA51", "SA52",
"SA53", "SA54", "SA56", "SA57", "SA58", "SA59", "SA60", "SA61",
"SA62", "SA63", "SA64", "SA65", "SA66", "SA67", "SA68", "SA69",
"SA72", "SA73", "SA74", "SA75", "SA76", "SA77", "SA78", "SA79",
"SA80", "SA81", "SA82", "SA83", "SA84", "SA85", "SA86", "SA87",
"SA88", "SA89", "SA90", "SA92", "SA93", "SA94", "SA95", "SA96",
"SA97", "SA99", "SA100", "SA101", "SA102", "SA103", "SA104",
"SA105", "SA107", "SA108", "SA109", "SA110", "SA111", "SA112",
"SA113", "SA114", "SA115", "SA116", "SA118", "SC01", "SC02",
"SC03", "SC04", "SC05", "SC06", "SC07", "SC08", "SC09", "SC10",
"SC11", "SC12", "SC13", "SC14", "SC15", "SC16", "SC17", "SC18",
"SC19", "SC20", "SC21", "SC22", "SC23", "SC24", "SC25", "SC26",
"SC27", "SC28", "SC29", "SC30", "SC31", "SC32", "SC33", "SC34",
"SC35", "SC36", "SC37", "SC38", "M01", "M02", "M03", "M04", "M05",
"M06", "M07", "M08", "M09", "M10", "M11", "M12", "M13", "M14",
"M15", "M16", "M17", "M18", "M19", "M20", "M21", "M22", "M23",
"M24", "M25", "M26", "M27", "M28", "M29", "M30", "M31", "M32",
"M33", "M34", "M35", "M36", "M37", "M38", "M39", "M40", "M41",
"M42", "M43", "M44", "M45", "M46", "M47", "M48", "M49", "M50",
"M51", "M52", "M53", "SA01", "SA02", "SA03", "SA04", "SA05",
"SA06", "SA07", "SA08", "SA09", "SA10", "SA11", "SA12", "SA13",
"SA14", "SA15", "SA16", "SA17", "SA18", "SA19", "SA20", "SA21",
"SA22", "SA23", "SA24", "SA25", "SA26", "SA27", "SA28", "SA29",
"SA30", "SA31", "SA32", "SA33", "SA34", "SA35", "SA36", "SA37",
"SA38", "SA39", "SA40", "SA41", "SA42", "SA43", "SA44", "SA45",
"SA46", "SA47", "SA48", "SA49", "SA50", "SA51", "SA52", "SA53",
"SA54", "SA56", "SA57", "SA58", "SA59", "SA60", "SA61", "SA62",
"SA63", "SA64", "SA65", "SA66", "SA67", "SA68", "SA69", "SA72",
"SA73", "SA74", "SA75", "SA76", "SA77", "SA78", "SA79", "SA80",
"SA81", "SA82", "SA83", "SA84", "SA85", "SA86", "SA87", "SA88",
"SA89", "SA90", "SA92", "SA93", "SA94", "SA95", "SA96", "SA97",
"SA99", "SA100", "SA101", "SA102", "SA103", "SA104", "SA105",
"SA107", "SA108", "SA109", "SA110", "SA111", "SA112", "SA113",
"SA114", "SA115", "SA116", "SA118", "SC01", "SC02", "SC03", "SC04",
"SC05", "SC06", "SC07", "SC08", "SC09", "SC10", "SC11", "SC12",
"SC13", "SC14", "SC15", "SC16", "SC17", "SC18", "SC19", "SC20",
"SC21", "SC22", "SC23", "SC24", "SC25", "SC26", "SC27", "SC28",
"SC29", "SC30", "SC31", "SC32", "SC33", "SC34", "SC35", "SC36",
"SC37", "SC38", "M01", "M02", "M03", "M04", "M05", "M06", "M07",
"M08", "M09", "M10", "M11", "M12", "M13", "M14", "M15", "M16",
"M17", "M18", "M19", "M20", "M21", "M22", "M23", "M24", "M25",
"M26", "M27", "M28", "M29", "M30", "M31", "M32", "M33", "M34",
"M35", "M36", "M37", "M38", "M39", "M40", "M41", "M42", "M43",
"M44", "M45", "M46", "M47", "M48", "M49", "M50", "M51", "M52",
"M53"), label = "Code of PrevenGo", format.spss = "A5", display_width = 12L),
group = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 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, 195, 157, 149, 151, 145, 165, 163, 126, 146,
113, 122, 184, 202, 196, 197, 179, 199, 185, 151, 161, 162,
165, 164, 161, 156, 153, 199, 156, 155, 160, 163, 209, 173,
125, 194, 170, 226, 197, 159, 122, 112, 199, 122, 163, 154,
194, 146, 138, 194, 149, 174, 125, 156, 163, 200, 142, 150,
163, 199, 118, 147, 163, 147, 157, 173, 170, 217, 127, 249,
158, 201, 170, 189, 149, 172, 184, 129, 148, 123, 186, 168,
141, 172, 108, 155, 164, 130, 152, 150, 72, 121, 180, 155,
156, 191, 151, 203, 146, 152, 186, 221, 172, 210, 174, 120,
151, 175, 143, 180, 169, 143, 117, 142, 146, 174, 173, 158,
197, 120, 128, 144, 172, 168, 211, 211, 226, 192, 179, 135,
185, 110, 165, 228, 175, 178, 150, 173, 161, 112, 131, 181,
166, 134, 163, 151, 175, 195, 190, 124, 159, 161, 115, 122,
173, 190, 145, 168, 199, 174, 159, 167, 155, 182, 167, 168,
199, 126, 144, 139, 162, 208, 132, 139, 154, 165, 188, 188,
130, 214, 150, 146, 178, 158, 165, 148, 171, 197, 160, 145,
171, 188, 168, 209, 156, 156, 207, 226, 151, 212, 159, 194,
122, 225, 140, 141, 173, 150, 134, 133, 121, 144, 146, 125,
184, 145, 167, 191, 149, 178, 129, 149, 176, 162, 171, 144,
162, 155, 173, 166, 147, 139, 156, 173, 146, 182, 134, 190,
161, 168, 224, 142, 113, 115, 200, 140, 141, 156, 190, 158,
199, 156, 199, 171, 135, 143, 139, 175, 159, 184, 12, 162,
112, 144, 161, 145, 161, 177, 188, 169, 190, 197, 112, 153,
193, 200, 165, 176, 185, 113, 150, 12, 163, 166, 115, 158,
185, 143, 179, 143, 157, 176, 163, 113, 192, 130, 142, 126,
166, 120, 155, 155, 114, 188, 175, 235, 155, 114, 155, 186,
146, 144, 171, 183, 113, 128, 144, 146, 182, 168, 179, 166,
100, 131, 225, 158, 199, 192, 201, 164, 149, 156, 171, 113,
168, 166, 182, 146, 146, 175, 172, 112, 129, 171, 185, 156,
184, 202, 131, 176, 186, 120, 168, 178, 165, 148, 190, 228,
140, 168, 178, 171, 108, 163, 171, 168, 174, 172, 271, 146,
165, 164, 168, 195, 163, 147, 158, 130, 212, 157, 159, 212,
183, 179, 189, 164, 180, 137, 192, 192, 181, 105, 150, 202,
202, 192), format.spss = "F4.2", display_width = 11L)), class = "data.frame", row.names = c(NA,
-404L))