% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/process_input.R
\name{process_PC}
\alias{process_PC}
\title{Process vertebral measurements and PC scores of traditional morphometric data}
\usage{
process_PC(data, pos = 1L, pcscores, eigenvals, posPC)
}
\arguments{
\item{data}{a data frame containing a column of vertebra indices and measurements for each vertebra, or a named list thereof for multiple specimens with the names of the list corresponding to the unique identifiers of each specimen.}

\item{pos}{the name or index of the variable in \code{data} containing the vertebra indices. Default is to use the first column.}

\item{pcscores}{a matrix or data frame containing PC scores of each vertebra. Note that for multiple specimens, an ordination method should have been performed on the concatenated data across all specimens so that \code{pcscores} is a single data frame or matrix containing scores for all specimens.}

\item{eigenvals}{a numeric vector containing the eigenvalues of each PC axis.}

\item{posPC}{a vector containing the positional information of vertebrae in \code{pcscores}, or a named list thereof for multiple specimens with the names of the list corresponding to the unique identifiers of each specimen. If not provided, will assume the row order of \code{pcscores} matches the vertebra order in \code{pos}.}
}
\value{
A \code{regions_pco} object, which contains user-provided eigenvectors in the \code{scores} component and eigenvalues in the \code{eigen.val} component. The original dataset, including positional information, is stored in the \code{data} attribute.
}
\description{
\code{process_PC()} initializes the analysis workflow by processing a dataset of vertebral measurements and already computed PC scores into an object usable by \pkg{MorphoRegions}. Such processing includes identifying the vertebra indices, measurements, and PC scores.
}
\details{
Unlike \code{process_measurements()}, \code{process_PC()} does not fill in missing values and these should have been removed or replaced by numeric values before running \code{process_PC()}.
}
\examples{
# Load dataset; vertebral index in first column
# ('Vertebra' column)
data("dolphin")

# Compute PC scores with prcomp:
PCA <- prcomp(dolphin[-1], scale = TRUE)

# Extract PC scores and eigenvalues:
PCA_scores <- as.data.frame(PCA$x)
PCA_eigenval <- PCA$sdev^2


# Process PC scores and morphological data:
pco_dolphin <- process_PC(data = dolphin,
                          pos = "Vertebra",
                          pcscores = PCA_scores,
                          eigenvals = PCA_eigenval,
                          posPC = dolphin[[1]])
}
\seealso{
\itemize{
\item \code{\link[=process_gmPC]{process_gmPC()}} for processing PC scores from 2D or 3D geometric morphometric datasets
\item \code{\link[=svdPCO]{svdPCO()}} for computing principal coordinate axes from processed vertebra data.
\item \code{\link[=plot.regions_pco]{plot.regions_pco()}} for plotting PCO axes
}
}
