Entering edit mode
2.6 years ago
José
▴
10
A very weird thing is happening to me on R, the first time i installed "ggfortify" pacakage to create a PCA plot, the result was an Rplots.pdf file, it worked perfectly. The second time i used it, with the same exact data and commands, the result is an empty Rplots.pdf file and continues to happen every time i try to run R.
Can someone tell me what is the problem?
I used the following commands in R:
library("ggfortify")
q<-read.table("result_file_PCA.rel",head=F)
q2<-read.table("file1.clst",head=T)
autoplot(prcomp(q), data = q2,colour = 'CLUSTER')
Thank you very much for your help.
The file was generated using this command:
the weirdest thing is that the first time i used R the result was great, a PCA plot just like it was intended. Then, in the following times the result was everytime an empty Rplots.pdf. I checked the result_file_PCA.rel and it's a perfectly normal distance matrix, the file is ok. It's weird.
Can you see the output from autoplot? if so, you can save it as object some thing like this:
Since ggfortify is based on ggplot, you can also use ggsave to save a plot.
I followed your suggestion and it worked. Thank you very much.
I’ve had problems with saving some plots outside of package specific functions (ie ggsave). What I noticed was that it mainly occurred when trying to overwrite a file but not when creating a new file.