2
$\begingroup$

I am trying to find the strongest correlation between two data sets in R and one set has 9000+ columns. I used cor() and it worked well, but is there a function or way to find the strongest correlation value and column name? Note that I do have many NA values in the correlation matrix, but this is to be expected for my situation. Any advice would be really appreciated.

$\endgroup$
2
  • 1
    $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$ Commented Nov 21, 2022 at 4:18
  • $\begingroup$ What about the other set? $\endgroup$ Commented Nov 21, 2022 at 5:45

1 Answer 1

3
$\begingroup$

I have some experience with this question, but it may not be the best. Suppose the correlation coefficient is stored in corr_df(a data frame [9000,1])

Try this code:

corr_df[order(corr_df[,1],decreasing = TRUE),]

It can rank the magnitude of the correlation coefficients from high to low, and also get the row(or col) for corresponding coefficient specifi.

I hope it will be helpful to you.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.