# \donttest{
## use iris dataset
data(iris)
X = as.matrix(iris[,1:4])
lab = as.factor(iris[,5])
## compare with PCA
outLDA = do.lda(X, lab, ndim=2)
outPCA = do.pca(X, ndim=2)
## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2))
plot(outLDA$Y, col=lab, pch=19, main="LDA")
plot(outPCA$Y, col=lab, pch=19, main="PCA")
par(opar)
# }
Run the code above in your browser using DataLab