Hi,
I am working on the expression datasets that has multiple-variables. I am using the FactoMineR
and pca3d
libraries for this purpose and was able to distinguish two factor levels belonging to a one variable column. However, I am not able to perform the PCA on the two variable columns that has different factor levels. Please let me know how can I do the PCA on multi-variable.
Below is the code I have ran with the one variable column;
Neg_Dct
## Column [1-4 and 269-272] of the data set contains variables/categorical data##
df = Neg_Dct[,-c(1:4, 269:272)]
library(FactoMineR)
nb_1 = estim_ncpPCA(df,ncp.max=5)
res.comp_1 = imputePCA(df,ncp=2)
res.pca_1 = PCA(res.comp_1$completeObs)
library(pca3d)
Node <- res.comp_1$completeObs
pca <- prcomp(Node, scale.=TRUE)
gr <- factor(Neg_Dct[,272])
summary(gr)
B_1 B_2
31 132
#2D plot##
pca3d(pca, group=gr)
#2D plot##
pca2d(pca, group=gr)
Thank you,
Toufiq
@ Kevin Blighe,
Thank you very much for the suggestions. Can I also perform 3D visualisation using the pcatools?
Sometimes, it does not show the Reply button to write back so I had to add the text in the comment section.
You cannot perform 3-D visualisation using PCAtools; however, I may implement it in the future. I provide some basic code for a 3-d PCA here: A: PCA plot from read count matrix from RNA-Seq
To respond my original answer, I think that you can use the
ADD COMMENT
button alone, no? It looks like you posted a new answer (but I moved it).@ Kevin Blighe ,
Noted. Thank you very much. This is helpful.