[R] Problem with factors in NMDS and Envfit

rodrock rodrigo.vargasgaete at gmail.com
Thu May 10 16:21:09 CEST 2012


Hi everybody, 
thanks in advance for your help!

I am working with genetic data performing an NMDS to visualize the genetic
differentiation of individuals from different species and populations in
different site conditions (site variables are all factors), and actually
genetic data also.
The data base is kind of big (> 1000 individuals x 551 variables)

Nmds so far has not worked with the genetic data input as factors it shows
me and error
 (maybe the distance is not the proper?)
as integer the NMDS works well

ord2<-metaMDS(gen_all_nonas,k = 2, distance="euclid", autotransform=F,
noshare=T, na.rm=T)

When I use envfit to see the correlation of the site factors it does not
work until I remove all Nas. Once I do that it works almost good ("I can
live" with the Nas removing) but somehow It show me an error considering the
factor: Populations where the individuals come from ("Pop")

exp_site<-envfit(ord2~Pop+Sp+Location+Soil+Water+Flooding+Ca, strata=Sp,
na.rm=T)# with strata
Error en `colnames<-`(`*tmp*`, value = "Pop") : 
  attempt to set colnames on object with less than two dimensions

I do not know what I am doing wrong, there are more than 40 Populations in
the data set but I get this problem. Once I remove "Pop" from the command It
works ok e.g., 
attach(site_all_nonas)

exp_site2<-envfit(ord2~Sp+Location+Soil+Water+Flooding+Ca, strata=Sp,
na.rm=T)# with strata Sp
exp_site2

Goodness of fit:
             r2 Pr(>r)    
Sp       0.5398  0.001 ***
Location 0.4174  0.001 ***
Soil     0.0090  0.511    
Water    0.0103  0.873    
Flooding 0.0234  0.515    
Ca       0.0334  0.901    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
P values based on 999 permutations, stratified within strata.



-----
Rodrigo Vargas G.
-----------------------------------------
Silviculture Institute
Freiburg University

--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-factors-in-NMDS-and-Envfit-tp4623645.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list