Learn R Programming

pcadapt (version 2.2)

corpca: Principal Component Analysis based on the correlation matrix

Description

corpca is an auxiliary function that performs principal components analysis on a dataset. It returns an object x which contains the loadings, the scores and the singular values of the K first principal components. It handles missing values in a dataset and actually computes the eigen elements of the n x n covariance matrix, where n is the number of individuals.

Usage

corpca(data, K, scale = TRUE, ploidy = 2)

Arguments

data
a data matrix or a data frame.
K
an integer specifying the number of principal components that are retained.
scale
a logical value indicating whether the data has to be scaled.
ploidy
an integer specifying the ploidy of the individuals.

Examples

Run this code
data <- read4pcadapt("geno3pops",option="example")
x <- corpca(data,K=3)

Run the code above in your browser using DataLab