View source: R/restoreShapes.r
restoreShapes | R Documentation |
restore shapes from PC-Scores or similar projections
restoreShapes(
scores,
PC,
mshape,
sizeshape = FALSE,
origsize = FALSE,
meanlogCS
)
scores |
vector of PC-scores, or matrix with rows containing PC-scores |
PC |
Principal components (eigenvectors of the covariance matrix) associated with 'scores'. |
mshape |
matrix containing the meanshape's landmarks (used to center the data by the PCA) |
sizeshape |
logical: if TRUE, it is assumed that the data is the output of |
origsize |
logical: if |
meanlogCS |
numeric: provide the average log Centroid Size of the original sample (see examples below). Only needed if |
Rotates and translates PC-scores (or similar) derived from shape data back into configuration space.
returns matrix or array containing landmarks
Stefan Schlager
prcomp
, procSym
getPCscores
if (require(shapes)) {
## generate landmarks using
##the first PC-score of the first specimen
proc <- procSym(gorf.dat)
lm <- restoreShapes(proc$PCscores[1,1],proc$PCs[,1],proc$mshape)
plot(lm,asp=1)
##now the first 3 scores
lm2 <- restoreShapes(proc$PCscores[1,1:3],proc$PCs[,1:3],proc$mshape)
points(lm2,col=2)
## Now restore some sizeshape data
procSize <- procSym(gorf.dat,sizeshape=TRUE)
est1 <- restoreShapes(range(procSize$PCscores[,1]),procSize$PCs[,1],procSize$mshape,
sizeshape=TRUE,origsize=TRUE,meanlogCS=procSize$meanlogCS)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.