PCAmyDF | R Documentation |
This function generates a PCA plot using the prcomp function in R.
PCAmyDF(
dfx,
labels,
factorV,
title = "PCA Plot",
scale,
center,
col_vector,
namePointBL = F
)
dfx |
a numeric matrix containing the data to be plotted |
labels |
a character vector containing the labels for each sample in |
factorV |
a factor or character vector indicating the group each sample belongs to |
title |
a character string specifying the title of the plot |
scale |
a logical value indicating whether the variables should be scaled to have unit variance |
center |
a logical value indicating whether the variables should be centered |
col_vector |
a vector of color names to be used for plotting the samples |
namePointBL |
a logical value indicating whether to include labels for each point |
If returnPCA
is TRUE, the function returns a list containing the PCA results. Otherwise, the function generates a PCA plot.
data("iris")
PCAmyDF(iris[,1:4], iris$Species, iris$Species, "Iris dataset", TRUE, TRUE, c("red", "blue", "green"), TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.