I am using R to visualize my PCA. But I got error messages in here. Anybody know how to solve it?
>pca.gseUCEC <- PCA(train_dataUCEC,graph = FALSE)
>
> fviz_pca_ind(pca.gseUCEC, geom = "point", col.ind = sedfUCEC[["secondary_gleason_grade"]])
Error in ans[ypos] <- rep(yes, length.out = len)[ypos] :
replacement has length zero
In addition: Warning message:
In rep(yes, length.out = len) : 'x' is NULL so the result will be NULL
>
> table(sedfUCEC[["secondary_gleason_grade"]])
< table of extent 0 >
sessionInfo( )
Please help to fix the issue, I am new in R and just follow others' code.
With only this snippet of code it is hard to help you on this (i.e. if I cannot reproduce it, I cannot really know what goes on).
Still, a couple of observations:
this seems related to the factoextra package (not on Bioc)
the message seems quite clear: you have no elements in sedfUCEC[["secondary_gleason_grade"]], as the table command reports
Please do invest more time in "just follow others' code". I know it takes an extra effort, but to the bare minimum, you can help us helping you.
This would include
making something like a reproducible example
grasping what the parameter of a function would expect, what errors are commonly thrown
printing out (also for yourself) the output of the commands you enter - it has a lot of value to see right away what formats your data is stored as
... and more, actually, but I don't want to scare you off from asking a question.
What I am saying: it is (much) easier for others to help you solve issues, and in many cases (been there a lot of times) by making it reproducible for yourself, you often find out what went wrong, and with some luck (and experience) you can solve the problem already.
There's no need to send me the full script, especially if it worked after fixing the values (passed correctly now, no error seems to be thrown?)
For the next steps: depends on what you plan to do, but my advice would be to follow some established workflows to see how these things are done inside these.
As an example: you might want to check out the fantastic TCGAbiolinks package.
Thank you for your answer
I foudn the problem was because I used vector function unlist in r and it got null value
I am using TCGA dataset for UCEC and OV disease.
How do I send my full script? I also adopt this code from youtube adjusting to my dataset.
Thank you
There's no need to send me the full script, especially if it worked after fixing the values (passed correctly now, no error seems to be thrown?)
For the next steps: depends on what you plan to do, but my advice would be to follow some established workflows to see how these things are done inside these.
As an example: you might want to check out the fantastic TCGAbiolinks package.
Federico