[R] Manipulating rownames for nMDS
morrokm
morrow.kathleen at gmail.com
Sun May 22 21:28:31 CEST 2011
I am trying to plot an nMDS plot using ggplot2. My rownames are coded so
that they can be broken down by Site, Species, Treatment, or Replicate based
on unique separators. There are no column headers. I am having trouble
coding ggplot2 to plot by Site -or- Species -or- Treatment and NOT by all
unique row names. This is probably a simple question but I'm still very new
with command line language.
This is an example of what my binary .csv data file looks like:
"Site_Species..Treatment.Replicate"
BLZ09_PA..CC.5 0 0 0 0
BX9_PA..CD.6 0 0 0 0
ST9_PA..CC.4 0 0 0 0
ST9_PA..CC.5 0 1 1 0
FX9_PA..CZ.8 0 0 0 0
FX9_PA..CY.8 0 0 0 0
BLZ09_MF..CC.4 0 0 0 0
BX9_MF..CD.1 0 0 0 0
ST9_MF..CC.3 1 0 0 1
ST9_MF..CC.4 1 0 0 1
FX9_MF..CH.1 1 1 0 0
FX9_MF..CH.2 1 0 0 0
This is the code I have thus far:
datum <- read.csv(q, header=F)
datum2 <- datum[,2:ncol(datum)]
rownames(datum2) <- datum[,1]
fit <- metaMDS(datum2, distance = "jaccard", k = 3, trymax=20,
autotransform=F)
fit. <- data.frame(sample=rownames(datum2), fit$points)
p <- qplot(X1,X2, col=sample, data=fit.)
print(p)
dev.off()
Thanks for your help!
--
View this message in context: http://r.789695.n4.nabble.com/Manipulating-rownames-for-nMDS-tp3542663p3542663.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list