[R] Adding legend to lda-plot, using the MASS-package

Arve Lynghammar arvely at gmail.com
Thu Oct 14 10:31:23 CEST 2010


Hi everyone!
I'm going to analyze the attached data set, but I'm not able to add the
correct legend. In other words, I can't see which species is which.

http://r.789695.n4.nabble.com/file/n2994991/test_discriminant_anal_alle.xls
test_discriminant_anal_alle.xls 

This is my commands:

data<- read.table("clipboard",header=TRUE)
library(MASS)
output<-lda(Species~., data)
scores=predict(output, data)$x
plot(scores, col=rainbow(4)[data$Species], asp=1)

Is there a quick way to add a legend to the plot with the corresponding
colours?

It's probably an easy way to do it, but now I've used too many days on
this...

Thank you in advance, 

Arve L.
-- 
View this message in context: http://r.789695.n4.nabble.com/Adding-legend-to-lda-plot-using-the-MASS-package-tp2994991p2994991.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list