Hello again, this should now work in the version that is on GitHub, i.e., selecting just a single PC for plotloadings(). You can install PCAtools direct from GitHub to avail of this. It will take another couple of months before the code is released on the official Bioconductor branch.
Hi,
I recently started using the PCAtools package and was wondering if it ploatloadings command also somehow allows the plotting of individual PCs.
I would be interested in plotting just the loading of PC1.
Overall, the packge works fine and I can modify the number of PCs plotted easily:
plotloadings(p, components = getComponents(pca_object, c(1,2)))
p: a pcaobject created as instructed in the plotloadings help section.
however any attempt to reduce the amount of components plotted below 2 results in the following error:
plotloadings(p, components = getComponents(pca_object, 1)
Error in x[, i] : incorrect number of dimensions
Does anyone know a way to work around this? Or can recommend another package I could use?
Thanks a lot!
1 answer
Hi, I am the PCAtools [main] developer. I possibly just need to add drop = FALSE when it subsets to just one PC, but I will have to test that.
Temporary alternatives:
- obtain the loadings manually via
pca_object$loadingsand plot them manually - generate the same plot for 2 or more PCs, and then edit in an external editor.
Thanks a lot for the quick replies and useful tipps!
Log in to answer this question.
Thanks a lot! (also for developing this package)
I got the loadings manually for know.