Perform principal component analysis (PCA) and return the results.
Source:R/pca_in_one.R
pca_in_one.Rd
Perform principal component analysis (PCA) and return the results.
Usage
pca_in_one(
data,
sample,
pca.num = 5,
plot = TRUE,
x = "pc1",
y = "pc2",
color = "species",
shape = "species"
)
Arguments
- data
A data frame where rows are samples and columns are indicators.
- sample
A data frame containing sample information, where one column is the sample names that match those in @param data description, without the need for row names.
- pca.num
The returned results include the number of principal components, with a default value of 10.
- plot
Whether to plot, with the default being to draw a scatter plot. The plotted graph is a ggplot2 object, which can be customized and enhanced using ggplot2.
- x
Which principal component to use as the X-axis, default is pc1.
- y
Which principal component to use as the Y-axis, default is pc2.
- color
Which grouping information to use as the color of the points, default is species.
- shape
Which grouping information to use as the shape of the points, default is species.