getPCAs<-function (eset, maxpc = 3) {
if (!is.matrix(eset)) {
require(Biobase)
ex <- Biobase::exprs(eset)
out <- Biobase::pData(eset)
}
else {
out <- NULL
ex <- eset
}
pca.res <- prcomp(t(ex))
x <- pca.res$x[, 1:maxpc]
colnames(x) <- paste("PC", 1:maxpc, sep = ".")
varex = round(100 * summary(pca.res)$importance[2, ])
db <- cbind.data.frame(x)
if (!is.null(out))
db <- cbind(db, out)
return(list(db = as.data.frame(db), varex = varex))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.