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

Caroline Wallis c.wallis at worc.ac.uk
Wed Feb 8 15:10:16 CET 2012


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

PhD student
University of Worcester

Tel: 01905 542441
Mobile: 07811 384641



More information about the R-sig-ecology mailing list