itsmecevi
itsmecevi

Reputation: 51

Create correlation result from tidyverse

I have some of correlation with tidyverse

data %>% 
  select_if(is.numeric) %>% 
  cor

output:

              age height      income
age     1.00000000     NA -0.00100384
height          NA      1          NA
income -0.00100384     NA  1.00000000

I want to visualize this cor..any suggestion?

Im trying with corrplot but it didnt work.

Upvotes: 1

Views: 649

Answers (1)

RLave
RLave

Reputation: 8364

This works:

mtcars %>% 
  select_if(is.numeric) %>% 
  cor(., use="complete.obs") %>% # we make the correlations, only on complete.obs
  round(., 3) %>%  # this just rounds up the numbers, we can remove it
  corrplot::corrplot(., method="number") # call to corrplot function

enter image description here

Note that if a correlation is small, the font color will be almost white. Play around with color options to adjust it.

Upvotes: 2

Related Questions