vmikk / metagMisc

Miscellaneous functions for metagenomic analysis.
MIT License
46 stars 11 forks source link

Strata argument from adonis2 can't be added #33

Open AndreaVazgel opened 3 months ago

AndreaVazgel commented 3 months ago

I'm trying to perform a pairwise comparison for my data, but when I add the "strata" argument from adonis2 it shows an error:

ad2_pair3 = adonis_pairwise(x = Datos, dd = data_dis, group.var = "Hg_level", permut = 9999, p.adj = T, method = "bray", strata = Site) ad2_pair3

Result: Error in check(sn, control = control, quietly = quietly) : Number of observations and length of Block 'strata' do not match.

However, I don't think that error make sense because I have run adonis2 with similar arguments and I didn't have any problem: ad2 = adonis2(data_dis ~ Hg_level, data = Datos, permutations = 9999, method = "bray", strata = Site) ad2

Result: adonis2(formula = data_dis ~ Hg_level, data = Datos, permutations = 9999, method = "bray", strata = Site) Df SumOfSqs R2 F Pr(>F)
Hg_level 2 3.128 0.0699 5.2609 0.0026 Residual 140 41.616 0.9301
Total 142 44.744 1.0000

Do you know what is the solution for this error? Or, Is there another way to introduce this argument?

Thx, Andrea.

vmikk commented 3 months ago

Hello Andrea,
Thank you for reporting this issue.
I'm afraid the current implementation of adonis_pairwise does not support strata argument.
I will add this enhancement to the to-do list.