This is a test version of Biostars. For the public version, visit https://www.biostars.org.
import PCA data into R as dataset to plot

HI,

I have a PCA text file from a 50KSNP array in "txt" format, the calculation is done by Tassel.

I want to plot the results in R.

I am not a trained user of R I tried to to use "ggbioplot" package and I get the error

"Expected a object of class prcomp, princomp, PCA, or lda"

i don't need to use the procomp function cause I already have the components

could you please guide me towards a solution.

pca

EDIT: I'm not sure my solution will work, as you may run into the same error. An untested hack would be to use class(data) <- "prcomp", but that may not work either.

If you have PC1 and PC2 and are looking to draw a biplot, draw a simple scatter plot using those values.


If you've already imported the data, use ggfortify:

library(ggfortify)
autoplot(data)

See this link on how to add colors, labels, etc

0 answers

No answers yet.

Log in to answer this question.