Re: [R] adonis (vegan package) and subsetted factors

From: Jari Oksanen <>
Date: Thu, 10 Apr 2008 23:41:42 +0300

On 10 Apr 2008, at 18:57, tyler wrote:

> On Thu, Apr 10, 2008 at 04:47:44PM +0100, Gavin Simpson wrote:
>> This behaviour arises from the following, using the in-built dune
>> data:
>>> newdune.env <- subset(dune.env, Management != "NM")
>>> newdune.env$Management
>> Levels: BF HF NM SF
>> Notice this hasn't dropped the empty level "NM", and this is what is
>> catching out adonis --- it is not checking for empty levels in the
>> grouping factor, as this shows:
>>> newdune <- dune[which(dune.env$Management != "NM"), ]
>>> adonis(newdune ~ Management*A1, data=newdune.env, permutations=100)
>> Call:
>> adonis(formula = newdune ~ Management * A1, data = newdune.env,
>> permutations = 100)
>> Df SumsOfSqs MeanSqs F.Model R2 Pr(>F)
>> Management 3.00000 0.57288 0.19096 1.27735 0.2694 <0.01 ***
>> For now, forcibly remove empty factor levels as per your second
>> example,
>> but I'll take a look at fixing adonis()
> Great, thanks!

Howdy folks,

Fine that this was taken care of while my wife and I were seeing Fellini's 8 1/2 in our laptop. Actually, this same problem recently emerged in varpart and could be lurking elsewhere in vegan. With some luck, this fix would have made its way to the latest minor CRAN release of vegan we had today. Unfortunately the Earth is designed so that you folks over there in Canada are lagging behind, and you were still asleep when we had our release here in Europe. It seems that CRAN was fast today, and the new version already is available as a source and Windows binary in the main CRAN home. With our faster release cycles this will be in CRAN rather soon, and it is immediately (or from our morning and Canada's late night) in packages at R-Forge.

Best wishes, Jari Oksanen mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 10 Apr 2008 - 22:16:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 Apr 2008 - 22:30:28 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive