Hello all, 

I am using
package ”FD” to calculate FDis for individual traits… However, I’ve run into a
problem. When I specify that the trait is ordinal I get an error message (see
code below). However, I also tried without specifying that body length is an
ordered factor and then the code works… It also works when I have multiple
traits (mixed ordinal and nominal traits). I thought it might be because I had
different row and column length (i.e. different number or species) in the two
data frames, but I checked this (see code below) and I also checked that the
species names match and come in the same order in the two data frames, so it can’t
be that. I have tried to search for an explanation online, but without any
luck. Does anyone have a clue what is causing this error? 


It might be
something very simple that I’ve missed… In that case I apologize in advance.


Best /Emma


My code is
the following: 


>
read.delim("body length.txt", dec=",",
row.names=1)->Trait

>
read.delim("Fish_abund.txt", dec=",",
row.names=1)->Abund

>
Trait$body.length..cm.<- ordered(Trait$body.length..cm.,
levels=c("bl1", "bl2", "bl3"))

>
Trait$body.length..cm.

 [1] bl3 bl3 bl1 bl2 bl1 bl1 bl3 bl1 bl1 bl1
bl1 bl1 bl3 bl2 bl2 bl1 bl2 bl1 bl2

[20] bl3
bl3 bl2 bl2 bl3 bl2

Levels: bl1
< bl2 < bl3

> ex1
<- dbFD(Trait, Abund, calc.FRic = FALSE)

Error in
names(x.s) <- x.rn :  'names'
attribute [25] must be the same length as the vector [1]

>
nrow(Trait)

[1] 25

>
ncol(Abund)

[1] 25 		 	   		  
	[[alternative HTML version deleted]]

