我试图找到一些数据的估计边际均值,但不断收到错误消息。
# Pairwise comparisons
library(emmeans)
pwc <- df1 %>% emmeans_test(Y ~ C, covariate = M,
p.adjust.method = "bonferroni")
返回
> # 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.
但是没有重复的列。我的所有列都没有命名为 std.error
检查错误表明这一点
█
├─<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.