import PCA data into R as dataset to plot
0
0
Entering edit mode
2.8 years ago
sara_johem • 0

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 • 876 views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2740 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6