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

syrovat at sci.muni.cz syrovat at sci.muni.cz
Thu Feb 9 11:11:39 CET 2012


Dear Caroline,
It seems that you response (community-like) data are Depth and Velocity.
Than a dataframe with these two variables should be on the left hand side
of the formula, while SFT on the right hand side.
Something like
adonis(LB[,2:3] ~ SFT, data=LB, method="canberra")
should work.
Cheers,
Vit



> Dear Caroline,
>
> I agree with Ivailo, maybe the problem is the data format, you should
> provide a community data format or at least manage data in that format
> (columns are variables and rows are samples).
>
> About the Errrors: rowSums (x, na.rm=TRUE)
>
> I am not sure but I think you're producing some NA values maybe becuse you
> have unequal sample sizes among different SFT. That's is only and
> hypotheis
> I am not sure about that, an please anyone to correct me!
>
> Have a good day,
>
> Gian
>
>
>
> --
> Gian Maria Niccol? Benucci, Ph.D.
> Department of Applied Biology
> University of Perugia
>
>
> *----- Do not print this email unless you really need to. Save paper and
> protect the environment! -----*
>
>
> On 8 February 2012 16:46, Ivailo <ubuntero.9161 at gmail.com> wrote:
>
>> 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.
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



More information about the R-sig-ecology mailing list