Hi, I am using package"ropls" to generate PCA plot. And I want to change the labels of observations on the plot, which is defaulted as the row name of m data set.
But, I do not know how to define the labels ("indices of "x") that I want to display in my PCA plot.
following the argument in the manual:
"parLabVc, Optional character vector for the labels of observations on the plot; default is NA [ie row names of ’x’, if available, or indices of ’x’, otherwise, will be used]"
Hi Etienne,
thank you for your answer. My observations belong to 5 groups. Can I assign each group with symbols of "circles", "triangles" and so on, respectively? That will be more clean that just like"S1,S2,S3,S4......." on the plot
Thank you for your help.
Yuan
You cannot use symbols (but special characters work). A better option would be to use colors according to your classes (use a factor in the parColFcVn argument):
> library(ropls)
> data(sacurine)
> pcaModel <- opls(sacurine[["dataMatrix"]])
> plot(pcaModel, typeVc = "x-score", parLabVc = paste0("S", 1:nrow(sacurine[["dataMatrix"]])), parAsColFcVn = as.factor(rep_len(paste0("G", 1:5), length.out = nrow(sacurine[["dataMatrix"]]))))
It works. Thank you so much