pcaRotation | R Documentation |
Retrieve PCA rotations from prcomp objects
pcaRotation(x, choices, offset, reverse = c(FALSE, FALSE))
x |
An object of prcomp |
choices |
Integer vector, indices of principal components, default the
first two PCs. If missing, |
offset |
Oither one or more rows's names in the rotation matrix, or indices, or a logical vector. The average of the rows specified by offset is set to zero. |
reverse |
Logical of the same length as |
testMatrix <- matrix(rnorm(1000), nrow=10)
testPCA <- prcomp(testMatrix)
testPCAscores <- pcaScores(testPCA)
testPCAscores.withOffset <- pcaScores(testPCA, offset=c(1,3,5))
## notice the average of offset-rows are near zero
colMeans(as.matrix(testPCAscores.withOffset)[c(1,3,5),])
testPCAscores.withReverse <- pcaScores(testPCA, reverse=c(TRUE, FALSE))
colMeans(as.matrix(testPCAscores.withReverse)[c(1,3,5),])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.