# [R] NMDS Ordination Graphics Problem

stephen sefick ssefick at gmail.com
Mon Apr 5 20:34:50 CEST 2010

```This is the easiest way I have found to do something similar to what you want.

#output of dput() easy way to share data with the list
x <- (structure(list(a = c(1L, 12L, 2L, 0L, 0L, 13L), b = c(4L, 17L,
5L, 2L, 1L, 15L), c = c(7L, 6L, 8L, 4L, 4L, 19L), d = c(9L, 2L,
1L, 7L, 6L, 10L), e = c(2L, 3L, 3L, 2L, 9L, 8L), f = c(5L, 7L,
2L, 1L, 10L, 9L)), .Names = c("a", "b", "c", "d", "e", "f"), class =
"data.frame", row.names = c("1i",
"2i", "3i", "1c", "2c", "3c")))

library(vegan)
library(ggplot2)

p <- metaMDS(x)

y <- do.call(rbind,strsplit(as.character(rownames(x)), split=""))
z <- data.frame(sample = y[,1], status = y[,2], p\$points[,1:2])
qplot(X1,X2, data=z, shape=status)

On Mon, Apr 5, 2010 at 12:58 PM, Trey <trey3_79 at hotmail.com> wrote:
>
> Dr. Stevens,
>
> Hi, my name is Trey Scott, and I'm a grad student of Brian McCarthy's.  He
> referred me to you because of your expertise in handling complex R problems.
> We were hoping you could help us solve a nagging problem that is prohibiting
> me from producing graphicl output.
>
> Here is a simple mock-up of the matrix I'm using
>
>        a     b     c     d     e     f
> 1i      1     4     7     9     2     5
> 2i      12   17    6     2     3     7
> 3i       2    5     8     1     3     2
> 1c      0    2     4     7     2     1
> 2c      0    1     4     6     9     10
> 3c      13   15   19   10    8     9
>
> Where:  1i-3i are "infested" sites, and 1c-3c are "control sites".  A-F are
> species found at each site.  I have several of these ordinations to perform
> on different variables (BA, density, RIV, cover, etc..., all in different
> matrices).  I'm running NMDS (metaMDS) ordinations on each matrices, and
> producing ordination graphs for each cloud of points.  The problem I have is
> that I cannot devise a way to split the cloud of points into infested and
> control so that I can deduce any significant groupings.  A simple difference
> in symbols/color (Ex. gray triangles for infested, black circles for
> control) would do.  Also, I understand the use of pch/col/cex, I just need
> to apply them to the "split".
>
> So:
>
> +   How would I split these out in R after I run the metaMDS in vegan?
> +   What code would be necessary to bring this about?
>
> McCarthy and I are at the end of our preoverbial rope on this; nothing has
> worked.
> --
> View this message in context: http://n4.nabble.com/NMDS-Ordination-Graphics-Problem-tp1751845p1751845.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.
>

--
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

```