Error when trying to find estimated marginal means in r

616 Views Asked by At

Im trying to do find the Estimated Marginal Means of some data but keep getting an error message.

# Pairwise comparisons
library(emmeans)

pwc <- df1 %>%  emmeans_test(Y ~ C, covariate = M,
    p.adjust.method = "bonferroni")

returns

> # Pairwise comparisons
> library(emmeans)
> pwc <- df1 %>% 
+   emmeans_test(
+     Y ~ C, covariate = M,
+     p.adjust.method = "bonferroni"
+   )
Error: Column name `std.error` must not be duplicated.
Run `rlang::last_error()` to see where the error occurred.

yet there is no duplicated column. None of my columns are named std.error enter image description here

checking for errors shows this

█
├─<error/tibble_error_column_names_must_be_unique>
│ Column name `std.error` must not be duplicated.
└─<error/vctrs_error_names_must_be_unique>
  Names must be unique.
Backtrace:
  1. df1 %>% emmeans_test(Y ~ C, covariate = M, p.adjust.method = "bonferroni")
  5. tibble::add_column(., std.error = std.error, .after = "estimate")
  6. tibble:::set_repaired_names(out, .name_repair)
  8. tibble:::repaired_names(...)
 11. vctrs::vec_as_names(...)
 13. vctrs:::validate_unique(names = names, arg = arg)
 14. vctrs:::stop_names_must_be_unique(names, arg)
 15. vctrs:::stop_names(...)
 16. vctrs:::stop_vctrs(class = c(class, "vctrs_error_names"), ...)
Run `rlang::last_trace()` to see the full context.
0

There are 0 best solutions below