View source: R/update.gpa.pca.R
update.gpa.pca | R Documentation |
Adds new specimens (landmarks) to an existing GPA and PCA.
update.gpa.pca(
original_data,
new_landmarks,
center.pca = TRUE,
scale.pca = FALSE,
...
)
original_data |
Either an |
new_landmarks |
a named set of n landmarks in D dimensions corresponding to the new specimens |
center.pca |
|
scale.pca |
|
... |
any optional arguments to pass to |
This function does the following:
1- Either runs a GPA (using Morpho::ProcSym
) and a PCA (using stats::prcomp
) if the input is an "array"
of landmarks; or extracts the GPA and runs a PCA (using stats::prcomp
) if the input is a "nosymproc"
or "symproc"
object.
2- Aligns the new landmarks onto the original GPA (using Morpho::align2procSym
).
3- Projects these superimposed landmarks onto the original PCA (using stats::predict
).
4- Merges and output the combined PCA containing the new specimens.
Thomas Guillerme
## Get some 3D data from Morpho
library(Morpho)
data(boneData)
original_landmarks <- boneLM
## Generate some random 3D data
new_spec <- array(data = c(apply(original_landmarks, c(1,2), mean),
apply(original_landmarks, c(1,2), median),
unlist(select.procrustes(proc_orig$rotated, selector = min))),
dim = c(10, 3, 3))
dimnames(new_spec)[[3]] <- paste0("new_", c("mean", "median", "min"))
## Run the GPA/PCA from the landmarks
update.gpa.pca(original_landmarks, new_spec)
## Run the GPA/PCA from a GPA
proc_orig <- Morpho::procSym(original_landmarks)
update.gpa.pca(proc_orig, new_spec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.