dorien dorien - 10 months ago 35
R Question

How to correlate and visualise correlation of one variable versus many

I want to use R to visualise and calculate the correlation of one variable data[1] to many other variables data[2:96]

I am already aware of what packages such as psych and PerformanceAnalytics have the Pairs function.

Ideally, I would like to output a graph like that Pairs outputs, but only for the correlations between data[1] and each of data[2:96], not for each of the elements of data[1:96] with itself, that would take up too much space. Any ideas on this would be appreciated.


Using mtcars data and the corrplot{} package:

mcor <- cor(x = mtcars$mpg, y = mtcars[2:11], use="complete.obs")
corrplot(mcor, = 25)

Edit: Forgot to put in a vignette for corrplot showing more ways to format it: