modified pca.R