# NOT RUN {
# generate data
X <- rbind(matrix(rnorm(100),nr=10),matrix(rnorm(100),nr=10)+10)
## 1. projection using 2 principal components
output <- do.pca(X,ndim=2)
plot(output$Y[,1],output$Y[,2])
## 2. automatic detection of target dimension accounting for 98% of variance
output <- do.pca(X,ndim="auto",varratio=0.98) # perform PCA
plot(seq_len(length(output$vars)),output$vars,type="b") # plot variances
# }
Run the code above in your browser using DataLab