| PCA | R Documentation |
Perform a simple PCA using stats::prcomp.
Optionally, it will create a PCA biplot using
factoextra::fviz_pca_biplot if
plot = TRUE.
PCA(data, plot = TRUE, ...)
data |
A numeric or complex matrix (or data frame) that will be used to perform the Principal Components Analysis. |
plot |
Boolean flag to indicate whether or not to create a PCA biplot. |
... |
Arguments passed on to
|
Data frame with PCA result.
# Toy dataset
example_data <- data.frame(ID = c(1,2,3,4,5),
P1 = c("one", "two", "three", "four", "five"),
T1 = rnorm(5),
T2 = rnorm(5))
example_data_pca <- PCA(example_data[, -c(1:2)])
# F1 Seedling Ionomics dataset
data(ionomics) # Includes some missing data
ionomics_rev <- MetaPipe::replace_missing(ionomics,
excluded_columns = c(1, 2),
replace_na = TRUE)
ionomics_pca <- PCA(ionomics_rev[, -c(1:2)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.