Entering edit mode
6.8 years ago
sandKings
▴
40
'#plot PCA using all genes
require(genefilter)
require(calibrate)
require(RColorBrewer)
library(ggplot2)
install.packages("ggfortify")
library(ggfortify)
pca=prcomp(t(count_matrix))
pc1var <- round(summary(pca)$importance[2,1]*100, digits=1)
pc2var <- round(summary(pca)$importance[2,2]*100, digits=1)
pc1lab <- paste0("PC1 (",as.character(pc1var),"%)")
pc2lab <- paste0("PC2 (",as.character(pc2var),"%)")
pdf(pdfname)
pdfname <-paste(direc,method,"PCA_FPKM_all_genes.pdf",sep="")
autoplot(pca,data=comparison,colour='Group',xlab=pc1lab,ylab=pc2lab)+geom_text_repel(aes_string(x = "PC1", y = "PC2", label = "Name"))
dev.off()
All lines execute seemingly without error but
autoplot(pca,data=comparison,colour='Group',xlab=pc1lab,ylab=pc2lab)+geom_text_repel(aes_string(x = "PC1", y = "PC2", label = "Name"))
returns the following error:
Error in ggbiplot(plot.data = plot.data, loadings.data = loadings.data, : formal argument "xlab" matched by multiple actual arguments
checking the value of xlab returns
> xlab
function (label)
{
labs(x = label)
}
<environment: namespace:ggplot2>
Could someone please help me debug this?
Thanks!
I'm running this on RStudio 3.3.1
Thanks, Kevin! Let me try this and see.