mr.raccoon
mr.raccoon

Reputation: 93

Rcompanion: Robust ANOVA: Error in list_to_dataframe(res, attr(.data, "split_labels"), .id, id_as_factor) : Results do not have equal lengths

I want to calculate robust ANOVA as explained on https://rcompanion.org/rcompanion/d_08a.html . I am getting the error "Error in list_to_dataframe(res, attr(.data, "split_labels"), .id, id_as_factor) : Results do not have equal lengths".

  1. What does the error mean?
  2. What is causing it?

I am using the groupwiseHuber function of rcompanion. R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Sum = groupwiseHuber(data = y2,
                     group = c("antifungal", "dose"),
                     var = "avg_rad",
                     conf.level=0.95,
                     conf.type="wald")

Sum

My data.frame looks like this:

structure(list(y = c(9.91e+08, 8.17e+08, 461200000, 15330000, 
175100000, 50320000, 13590000, 22970000, 2778000, 3453000, 12890000, 
375900000, 44590000, 1.611e+09, 1e+09, 889900000, 373200000, 
NA, NA, NA, NA, NA, 5010000, 6549000, 23160000, 32520000, 7707000, 
556900000, 634600000, 820900000, 391400000, 498300000, 147900000, 
646900000, 22060000, 1e+07, 306800000, 319400000, 41290000, 94100000, 
127200000, 117200000, 618300000, 570700000, 617100000, 284900000, 
449600000, 3866000, 6918000, 4177000, 14870000, 29380000, 2815000, 
1619000, 3126000, 1710000, 2191000), x = structure(c(1L, 1L, 
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L), levels = c("untreated", "VRZ", "AMB"
), class = "factor"), dose = structure(c(1L, 1L, 1L, 2L, 2L, 
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
2L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 
3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 
3L, 3L, 3L, 3L), levels = c("0", "5", "20"), class = "factor")), row.names = c(NA, 
-57L), class = c("tbl_df", "tbl", "data.frame"))

Upvotes: 1

Views: 52

Answers (1)

Sal Mangiafico
Sal Mangiafico

Reputation: 510

The NA's in your dependent variable are causing the error.

You can remove them with

y2 = subset(y2, !is.na(y))

It appears that the groupwiseHuber() function doesn't handle any NA values. This has to do with the output produced by DescTools::HuberM when there is an NA value and when a confidence interval is requested. I'm seeing if the function can be improved in this respect, but the simple solution is to simply remove NA values.

Upvotes: 1

Related Questions