I apologise for the tags, but StackOverflow wouldn't let me make a new tag for pairwiseAdonis, so I had to use vegan instead, since this technically concerns a post-hoc test for it.
I downloaded pairwiseAdonis to do some PERMANOVA (vegan) post-hoc tests, and it seems to work. However, every time I run a test, I get one of these warnings for each row of data:
In if (class(x) == "dist") { :
the condition has length > 1 and only the first element will be used
I'm not sure what this means, and I'm not experienced enough to start unpicking the code for the package to figure out what is going on. My main concern is if this an error that could mean all the results I get are meaningless? If so, can you recommend any other post-hoc test for PERMANOVA that I could use instead?
Here's a portion of my data (via dput(lengths_year)) and the code, in case you want to try it out for yourself.
structure(list(method = c("GEMAX", "GEMAX", "GEMAX", "GEMAX",
"GEMAX", "GEMAX", "GEMAX", "GEMAX", "GEMAX", "GEMAX", "GEMAX",
"GEMAX", "GEMAX", "GEMAX", "GEMAX", "GEMAX", "GEMAX", "GEMAX",
"GEMAX", "GEMAX"), method_year = c("GE_2017", "GE_2017", "GE_2017",
"GE_2017", "GE_2017", "GE_2017", "GE_2017", "GE_2017", "GE_2017",
"GE_2017", "GE_2017", "GE_2017", "GE_2017", "GE_2017", "GE_2017",
"GE_2017", "GE_2017", "GE_2017", "GE_2017", "GE_2017"), season_year = c("summer 2017",
"summer 2017", "summer 2017", "summer 2017", "summer 2017", "summer 2017",
"summer 2017", "summer 2017", "summer 2017", "summer 2017", "summer 2017",
"summer 2017", "summer 2017", "summer 2017", "summer 2017", "summer 2017",
"summer 2017", "summer 2017", "summer 2017", "summer 2017"),
station = c("1", "1", "1", "1", "1", "3", "3", "3", "3",
"3", "5", "5", "5", "5", "5", "6", "6", "6", "6", "6"), sample = c("1",
"2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3",
"4", "5", "1", "2", "3", "4", "5"), `1` = c(0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), `1.5` = c(0,
25, 0, 0, 23.0769230769231, 0, 16.6666666666667, 50, 14.2857142857143,
0, 0, 50, 0, 40, 0, 0, 30, 15.3846153846154, 9.09090909090909,
7.69230769230769), `2` = c(0, 12.5, 22.2222222222222, 0,
38.4615384615385, 20, 16.6666666666667, 0, 28.5714285714286,
0, 0, 0, 0, 0, 0, 18.1818181818182, 30, 7.69230769230769,
45.4545454545455, 15.3846153846154), `2.5` = c(0, 0, 11.1111111111111,
33.3333333333333, 7.69230769230769, 0, 33.3333333333333,
0, 0, 0, 0, 0, 0, 0, 0, 9.09090909090909, 10, 15.3846153846154,
9.09090909090909, 15.3846153846154), `3` = c(0, 0, 0, 16.6666666666667,
7.69230769230769, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9.09090909090909,
0, 15.3846153846154, 0, 15.3846153846154), `3.5` = c(0, 25,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15.3846153846154,
0, 7.69230769230769), `4` = c(0, 0, 0, 16.6666666666667,
7.69230769230769, 0, 0, 0, 0, 0, 50, 25, 0, 0, 0, 0, 0, 0,
0, 0), `4.5` = c(16.6666666666667, 0, 11.1111111111111, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), `5` = c(16.6666666666667,
12.5, 0, 0, 7.69230769230769, 0, 0, 50, 0, 0, 0, 0, 0, 0,
0, 9.09090909090909, 10, 0, 0, 7.69230769230769), `5.5` = c(16.6666666666667,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 7.69230769230769
), `6` = c(0, 12.5, 0, 0, 7.69230769230769, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 7.69230769230769, 9.09090909090909,
0), `6.5` = c(16.6666666666667, 0, 0, 0, 0, 20, 0, 0, 0,
0, 0, 0, 0, 20, 0, 9.09090909090909, 0, 0, 0, 0), `7` = c(16.6666666666667,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9.09090909090909,
0, 0, 0, 0), `7.5` = c(0, 0, 11.1111111111111, 16.6666666666667,
0, 0, 16.6666666666667, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0,
0, 7.69230769230769), `8` = c(0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 9.09090909090909, 0), `8.5` = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
`9` = c(0, 12.5, 11.1111111111111, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 10, 15.3846153846154, 0, 0), `9.5` = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 33.3333333333333, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0), `10` = c(16.6666666666667, 0, 11.1111111111111,
0, 0, 0, 0, 0, 28.5714285714286, 0, 0, 0, 0, 0, 0, 9.09090909090909,
0, 0, 9.09090909090909, 0), `10.5` = c(0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 9.09090909090909, 0, 0, 0, 0),
`11` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0), `11.5` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 7.69230769230769, 9.09090909090909, 0),
`12` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0), `12.5` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0), `13` = c(0, 0, 0, 0, 0, 0, 0,
0, 14.2857142857143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.69230769230769
), `13.5` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0), `14` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0), `14.5` = c(0, 0, 0, 16.6666666666667,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), `15` = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0),
`15.5` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0), `16` = c(0, 0, 11.1111111111111, 0, 0, 0, 16.6666666666667,
0, 0, 33.3333333333333, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0), `16.5` = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 20, 0, 50, 0, 0, 0, 0,
0), `17` = c(0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 20,
0, 0, 0, 0, 0, 0), `17.5` = c(0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), `18` = c(0, 0, 11.1111111111111,
0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 20, 0, 9.09090909090909, 0,
0, 0, 0), `18.5` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 33.3333333333333,
0, 25, 0, 0, 0, 9.09090909090909, 10, 0, 0, 0), `19` = c(0,
0, 0, 0, 0, 20, 0, 0, 14.2857142857143, 0, 0, 0, 20, 0, 0,
0, 0, 0, 0, 0), `19.5` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0), `20` = c(0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.69230769230769),
`20.5` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0), `21` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0), `21.5` = c(0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), `22` = c(0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), year_station = c("summer 2017 1",
"summer 2017 1", "summer 2017 1", "summer 2017 1", "summer 2017 1",
"summer 2017 3", "summer 2017 3", "summer 2017 3", "summer 2017 3",
"summer 2017 3", "summer 2017 5", "summer 2017 5", "summer 2017 5",
"summer 2017 5", "summer 2017 5", "summer 2017 6", "summer 2017 6",
"summer 2017 6", "summer 2017 6", "summer 2017 6")), row.names = c(NA,
-20L), class = c("tbl_df", "tbl", "data.frame"), .Names = c("method",
"method_year", "season_year", "station", "sample", "1", "1.5",
"2", "2.5", "3", "3.5", "4", "4.5", "5", "5.5", "6", "6.5", "7",
"7.5", "8", "8.5", "9", "9.5", "10", "10.5", "11", "11.5", "12",
"12.5", "13", "13.5", "14", "14.5", "15", "15.5", "16", "16.5",
"17", "17.5", "18", "18.5", "19", "19.5", "20", "20.5", "21",
"21.5", "22", "year_station"))
Code:
library(vegan)
library(pairwiseAdonis)
Y <- lengths_year[, c(7:20, 22:25, 27, 30, 33:34, 36:38, 40:42, 44)]
set.seed(1)
adonis(Y ~ lengths_year$year_station)
pairwise.adonis(Y, lengths_year$year_station, p.adjust.m = "BH")
In general, warnings are warnings: they are not fatal, but give you information. Your result object is not of class "dist"
, but it is a tibble. This means that in this case the object is handled correctly (well, it is a tibble, but still...). It seems that package pairwiseAdonis is hit by new more stringent interpretation of logical conditions (if
): the package should use if (inherits(x, "dist"))
instead of if (class(x) == "dist")
because the analysed object has several classes, but if
wants to have only one result and use only one condition.