[R] Problem with ordiellipse coloured factor in Vegan

Suparna Mitra suparna.mitra.sm at gmail.com
Fri May 17 05:56:52 CEST 2013


Hello R experts,
  I am trying to plot ordiellipse for my data but the col according to
factors.

Metabolites_raw= read.csv(file.choose(), head = TRUE) #file
21Metabolites.csv

Metabolites_t=t(Metabolites_raw[,2:82])

ord <- metaMDS(Metabolites_t, distance="bray")

symbol=as.numeric(Metab_metadata$LandType)

col.list <- c("red","slategray","seagreen","cyan","pink","brown","black",
"blue","yellow","magenta")

 palette(col.list)

 plot(ord$points, col = Metab_metadata$Day+2,pch=symbol, xlim=c(-0.3,0.35))

legend(.28,.25, c("0", "8", "16"),fill = c(2, 10,18))

# draw dispersion ellipses around data points

groupz <-c(2,10,18)

for(i in seq(groupz)) {

ordiellipse(ord, Metab_metadata$Day, kind = "sd", label = T,col=groupz[i],
show.groups=groupz[i])

}

Now here I get the error

Error in text.default(...) : no coordinates were supplied (But sometimes
same code works. I am not sure what am I doing wrong.)

Data files are attached.

Any help will be really great.

Thanks,

Mitra


More information about the R-help mailing list