[R-sig-eco] RDA with only dummy variable in environmental matrix

Zoltan Botta-Dukat bdz at botanika.hu
Tue Jun 22 20:48:53 CEST 2010


Dear Amelie,

as.factor(mat.env[,1])

It does not change your environmental matrix into factor, just print its 
values as factor.


You should use data.frame instead of factor for environmental data. Like 
this:

mat.env = data.frame(TYPE=c("NAT","NAT","NR","REST"), row.names = 
c("sites1","sites2", "sites3","sites4"))
rda(mat.sp~TYPE,data=mat.env)

Zoltan

2010.06.22. 16:15 keltezéssel, amelie_can írta:
> Hello Zoltan,
>
> thank you for your reply. When I tried what you suggested, the rda
> calculation did not proceed and I received this error message: "Error in
> colMeans(x, na.rm = TRUE) : 'x' must be numeric".
>
> This is the same example I used yesterday, but with the changes you
> proposed:
> mat.sp = matrix(c(40, 20, 37, 49, 52, 34, 35, 87, 90, 45, 49, 52, 34, 35,
> 87,5,39,99,8,45),nrow = 4, ncol=5, dimnames = list(c("sites1", "sites2",
> "sites3","sites4"),c("sp1", "sp2", "sp3", "sp4", "sp5")))
> mat.env = matrix(c("NAT","NAT","NR","REST"),4,1, dimnames = list(c("sites1",
> "sites2", "sites3","sites4"),c("TYPE")))
> as.factor(mat.env[,1])
> summary(mat.env)
>
> rda = rda (mat.sp,mat.env)
> summary(rda)
> plot(rda, scaling=1, type="points")
>
> Do you know what is the problem?
>



More information about the R-sig-ecology mailing list