Say that I have a sample dataframe like so.
sample_df <- data.frame(replicate(100,sample(0:1,1000,rep=TRUE)))
One thing you could ask is which columns in the dataframe are most correlated to column X1. I know how to do this, with the following code below, which displays the top 5 correlations.
library(lares)
corr_var(sample_df,
X1,
top = 5
)
However, instead of just focusing on X1, I want to know which columns are most correlated to both X1 and X2. How could I do this?