Hi everyone,

I was wondering, I understand that if you do plotVar on a pca, you’ll be plotting cor(mypca$X, mypca$x, use = “pairwise”). However, that object does not exist as such under myacp$whatever. Wouldn’t it be nice to easily getting it? How about under $loadings instead of loadings = rotation? That could be handy if one chooses not to use plotVar and plot the data otherwise.

Best,

David.

# Correlation coefficients from plotVar on PCA

Hi David,

Long time no see! What you want is already stored in plotVar but the output names are not very explicit, I am afraid, hence the confusion. Here is an example using rcc (but applies to any method)

data(nutrimouse)

X <- nutrimouse$lipid

Y <- nutrimouse$gene

nutri.res <- rcc(X, Y, ncomp = 3, lambda1 = 0.064, lambda2 = 0.008)

result <- plotVar(nutri.res, comp = c(1,3), cutoff = 0.5) # here to simplify I put a cutoff on the variables

The x and y coordinates of this plot give you those correlations, and you can extract them as:

result$x

result$y

And because we have not made this very user-friendly, the matching names of the variables are in:

result$names

We will take your suggestion on board and make this output more explicit and more beautiful. Thanks!

Kim-Anh

Thanks a lot, Kim-Anh!

Best,

D.