Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I made this function to do pairwise comparisons when there is a significant interaction between factors in adonis.
I don´t know if this interests to you, but fell free to include in the package.
Case example:
library(vegan)
library (ade4)
library(pairwiseAdonis)
data(aravo)
Com <- aravo$spe # Community composition of vascular plants
Env <- aravo$env # landform and zoogenic disturbance indices are categorical variables with five and three categories, respectively
adonis2(Com ~ Form * ZoogD, data = Env, permutations = 999)
There is a significant interaction, so we should analyse only the interaction. To do this, we should do a pairwise comparison for the factor of interest within each level of the other factor (i.e., to do pair-wise comparisons among levels of factor A within each level of factor B) and vice versa (Anderson, Gorley & Clarke, 2008).
interaction.adonis(x = Com, Env$Form, Env$ZoogD)
The function returns a list for each factor comprissed of pairwise comparisons within each of its levels, so that we can analyse how the effects of one factor varies between the levels of the other factor.
'x' can be a "data frame" or a "dist" object.