Learn R Programming

Morpho (version 2.12)

restoreFromPCA: restore original data from PCA

Description

restore original data from PCA by reverting rotation and centering

Usage

restoreFromPCA(scores, rotation, center)

Arguments

scores

matrix containing the PC-scores

rotation

matrix containing the PCs

center

vector containing the center

Examples

Run this code
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