restore original data from PCA by reverting rotation and centering
restoreFromPCA(scores, rotation, center)
matrix containing the PC-scores
matrix containing the PCs
vector containing the center
myirispca <- prcomp(iris[,1:4])
myirisRecovered <- restoreFromPCA(myirispca$x,myirispca$rotation,myirispca$center)
all.equal(myirisRecovered,as.matrix(iris[,1:4]))
Run the code above in your browser using DataLab