Correlation Matrix in R (3 Examples) | Compute & Draw Plot of Variable Relations | cor Function

preview_player
Показать описание
R code of this video:

x1 <- rnorm(1000)
x2 <- rnorm(1000) + 0.2 * x1
x3 <- runif(1000) + 0.1 * x1 - 0.2 * x2

##### Example 1
cor(data) # Correlation matrix of example data

##### Example 2
library("corrplot")
corrplot(cor(data), method = "circle") # Apply corrplot function

##### Example 3
library("ggcorrplot")
ggcorrplot(cor(data)) # Apply ggcorrplot function
Рекомендации по теме
Комментарии
Автор

First time I learn about this Graph type!! Awesome!!

agsoutas
Автор

This is very insightful Joachim, thank you. So if you have a dataset with more than variables you need to perform correlation; you need to specify the variables inside the data name of the df

AdamHancy
Автор

Thank you for such Fantastic and simple to execute the code .

deepaliab
Автор

Thank you so much man you are fantastic

Devilyte
Автор

How would I go about creating a correlation between categorical/dummy variables?

panwall
Автор

how can i put coefficient and significance value inside the box

ruchithruchi
Автор

sir, in the example 2 i need bigger plot for 38 variables, how can we use this function for better visualization?

sandipgarai
Автор

how we can compute a correlation matrix in case we have categorical and quantitive variables ?

khaoulazarouale
Автор

What does a negative correlation mean 🤔

sfundomabaso