summary_fit | R Documentation |
Create a plot which shows a summary of the fit your PCA model.
summary_fit(data)
data |
data frame with all data. See details for more information. |
The data frame data
should contain 3 variables. PC
,
R2cum
and Q2cum
.
A ggplot2 plot is returned.
Rico Derks
library(pcaMethods) # create some dummy data my_data <- data.frame(samples = c(rep("a", 10), rep("b", 10)), matrix(data = rnorm(400), nrow = 20)) # as cross validation q2 needs to be selected M1 <- pca(object = my_data, nPcs = 5, cv = "q2") # create data frame with R2 and Q2 sumfit_data <- data.frame(PC = paste("PC", 1:5, sep = ""), R2cum = M1@R2cum, Q2cum = M1@cvstat) # create the summary plot p <- summary_fit(sumfit_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.