On Thu, 2011-11-24 at 12:16 +0000, Edwin Lebrija Trejos wrote: > Hi, First I should note I am relatively new to R so I would appreciate > answers that take this into account. > > I am trying to perform an MDS ordination using the function “metaMDS” > of the “vegan” package. I want to ordinate species according to a set > of functional traits. “Species” here refers to “sites” in traditional > vegetation analyses while “traits” here correspond to “species” in > such analyses. > > My data looks like this: > > Trait1 Trait2 Trait3 Trait4 Trait5 Trait… > Species1 228.44 16.56 1.66 13.22 1 short > Species2 150.55 28.07 0.41 0.60 1 mid > Species3 NA 25.89 NA 0.55 0 large > Species4 147.70 17.65 0.42 1.12 NA large > Species… 132.68 NA 1.28 2.75 0 short > <snip />
> Can anyone guide me to get the trait (“species”) scores to plot > together with my species (“site”) scores? > Thanks in advance, > Edwin I think you should pass metaMDS the species trait matrix and then get it to use FD to compute the dissimilarities. Note from ?metaMDS there is a distfun argument for metaMDSdit. metaMDS passes the community data to metaMDSdist to compute the dissimilarities. The only snag is that gowdis doesn't accept a `method` argument so we need a wrapper: wrapper <- function(x, method, ...) { gowdis(x, ...) } then do metaMDS(SpeciesGowdis, distfun = wrapper, XXXXX) where XXXX represents any other arguments you want to pass to gowdis via our wrapper. Essentially the wrapper ignores the method argument, we just need it as metaMDSdist wants to call the dissimilarity function with a method argument. This is not tested as there wasn't reproducible code, but hopefully you'll be able to work it out from the above. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.