I got error when visualizing my PCA
1
0
Entering edit mode
m610110001 • 0
@f4448112
Last seen 21 months ago
Taiwan

Hello Guys,

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.

Thank you

PCAtools pcaExplorer pcaMethods • 1.6k views
ADD COMMENT
0
Entering edit mode
@federico-marini-6465
Last seen 4 months ago
Germany

Hi m610110001,

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.

Cheers,
Federico

ADD COMMENT
0
Entering edit mode

Thank you for your answer

I foudn the problem was because I used vector function unlist in r and it got null value

train_dataUCEC <- unlist(t(expr_filteredUCEC))
train_dataUCEC <- log2(train_dataUCEC+0.5)

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 692 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