I am getting PCA components using preProcess() from caret in R, and getting quantitative results.
dataPCA <- preProcess(data[1:ncol(data)-1], method = "pca", thresh = 0.95)
print(dataPCA)
print(dataPCA$rotation)
PCATrain <- predict(dataPCA,dataTrain[,1:ncol(dataTrain)-1])
PCATest <- predict(dataPCA,dataTest[,1:ncol(dataTest)-1])
However, I'd like to plot the components and variances explained, like you'd do with prcomp with plot(pca, type="1"). Is it possible using preProcess() or should I run prcomp()?
preProcess
doesn't save that info. I'd use prcomp
.