# NOT RUN {
col <- 20
row <- 1000
mat <- matrix(rexp(col*row, rate = 1), ncol = col)
# Adding some structure to make it more interesting.
mat[1:100,1:3] <- mat[1:100,1:3] + 5
mat[1:100+100,3:6] <- mat[1:100+100,3:6] + 5
mat[1:100+200,7:10] <- mat[1:100+200,7:10] + 5
mat[1:100+300,11:15] <- mat[1:100+300,11:15] + 5
p <- pca(mat)
chosen <- findElbowPoint(p$variance)
plot(p$variance)
abline(v=chosen, col="red")
# }
Run the code above in your browser using DataLab