[R-sig-eco] adonis: error in rowSums

Ivailo ubuntero.9161 at gmail.com
Wed Feb 8 16:46:38 CET 2012


On Wed, Feb 8, 2012 at 4:10 PM, Caroline Wallis <c.wallis at worc.ac.uk> wrote:
> I am trying to use the 'adonis' function in the 'vegan' package to assess differences in water depth and water velocity between areas of a river channel categorised by surface flow type (6 types in total, unequal sample sizes).
>
> Sample Data (LB):
>
> SFT     Depth   Vel
> BSW     0.18    1.2
> BSW     0.16    1.03
> BSW     0.16    0.98
> BSW     0.22    0.53
> BSW     0.11    0.668
> BSW     0.14    0.432
> BSW     0.12    0.391
> BSW     0.16    0.647
> BSW     0.2     0.903
> BSW     0.3     0.594
> BSW     0.37    0.429
> ....
>
> The dependent data was used in data frame format, rather than a dissimilarity matrix.
>
> Using the call 'adonis(formula=SFT~Depth*Vel,data=LB,permutations=999,method="canberra",strata=NULL)' I get the following error:
>
> Error in rowSums (x, na.rm=TRUE)
> 'x' must be an array of at least two dimensions
>
> I examined the adonis code to find 'x'. It first appears at the permutation stage:
>
> if (missing(strata))
>        strata <- NULL
>    p <- sapply(1:permutations, function(x) permuted.index(n,
>        strata = strata))
>    tH.s <- lapply(H.s, t)
>    tIH.snterm <- t(I - H.snterm)
>    f.perms <- sapply(1:nterms, function(i) {
>        sapply(1:permutations, function(j) {
>            f.test(tH.s[[i]], G[p[, j], p[, j]], df.Exp[i], df.Res,
>                tIH.snterm)
>
> However I'm no closer to understanding what 'x' is or how to correct the error. If anyone could offer any advice or help I'd be very grateful.
>
> I also tried transposing the data but this generated a different error!
>
> Regards,
>
> Caroline Wallis

Dear Caroline,

you need to provide a community table (i.e. species x samples data
frame) to adonis, but you have provided a single categorical variable.
Therefore I am not sure if the adonis() function would be appropriate
for the analysis you're trying to perform.

Cheers,
Ivailo
-- 
UBUNTU: a person is a person through other persons.



More information about the R-sig-ecology mailing list