I have a data matrix that contains site data for paired infested and control plots. For example: ab ac ad af ag ah 1 .024 x x x x x 2 .9 x x x x x 3 1.5 x x x x x 4 2.3 x x x x x 5 1.0 x x x x x 1c .75 x x x x x 2c 2.1 x x x x x 3c 1.7 x x x x x 4c 10.2 x x x x x 5c 2.1 x x x x x where: 1-5 stand for infested sites, and 1c-5c stand for control sites. Row 1 headings are the species within each site. Numerical data exists for all columns, the x's are used here just to fill out the matrix. What I seek to do is to split out the "infested" sites from the control "sites" in my subsequent graphical plot of the ordination. I know there is a simple way to do this, but I have not discovered it. Once I split them I can create unique graphical parameters for each to display within the plot; I know how to alter graphics and how to plot sites alone in the graphical output. Anyone know how to split these out? -- View this message in context: http://n4.nabble.com/How-to-split-data-for-NMDS-plots-tp1751101p1751101.html Sent from the R help mailing list archive at Nabble.com.
Here is the code I have used to this point:> trba<-read.table("c:\\Rdata\\NMDS\\trba.txt",header=T,row.names=1) > attach(trba) > trba >bat<-metaMDS(trba)plot(bat, display = c("sites")) Given this simple code and my previous example of the matrix, how would I go about splitting the data out for the plot? -- View this message in context: http://n4.nabble.com/How-to-split-data-for-NMDS-plots-tp1751101p1751104.html Sent from the R help mailing list archive at Nabble.com.
On Apr 4, 2010, at 3:50 PM, Trey wrote:> > I have a data matrix that contains site data for paired infested and > control > plots. For example: > ab ac ad af ag ah > 1 .024 x x x x x > 2 .9 x x x x x > 3 1.5 x x x x x > 4 2.3 x x x x x > 5 1.0 x x x x x > 1c .75 x x x x x > 2c 2.1 x x x x x > 3c 1.7 x x x x x > 4c 10.2 x x x x x > 5c 2.1 x x x x xWell, after reading with read table and textConnection, it's not a "data.matrix" but this was a dataframe: dta$infect <- grepl("c", row.names(dta)) > dta ab ac ad af ag ah infect 1 0.024 x x x x x FALSE 2 0.900 x x x x x FALSE 3 1.500 x x x x x FALSE 4 2.300 x x x x x FALSE 5 1.000 x x x x x FALSE 1c 0.750 x x x x x TRUE 2c 2.100 x x x x x TRUE 3c 1.700 x x x x x TRUE 4c 10.200 x x x x x TRUE 5c 2.100 x x x x x TRUE (I did not like the way plot.formula handled the logical variable infect so I "factorized it.) plot(ab ~ as.factor(infect), data=dta)> > where: 1-5 stand for infested sites, and 1c-5c stand for control > sites. Row > 1 headings are the species within each site. Numerical data exists > for all > columns, the x's are used here just to fill out the matrix. What I > seek to > do is to split out the "infested" sites from the control "sites" in my > subsequent graphical plot of the ordination. I know there is a > simple way > to do this, but I have not discovered it. Once I split them I can > create > unique graphical parameters for each to display within the plot; I > know how > to alter graphics and how to plot sites alone in the graphical output. > Anyone know how to split these out? > -- > View this message in context: http://n4.nabble.com/How-to-split-data-for-NMDS-plots-tp1751101p1751101.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 > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD West Hartford, CT
In essence, here is what I'm after: When I plot the NMDS ordination, I get a cloud of points. To make sense of this cloud I need to differentiate the cloud into control and infested sites to see if there is any meaningful separation. The first 5 plots are "infested", and the second 5 plots are "control". So how might I insert code into either the plot or point code lines to bring about this differentiation? -- View this message in context: http://n4.nabble.com/How-to-split-data-for-NMDS-plots-tp1751101p1751130.html Sent from the R help mailing list archive at Nabble.com.