Correlation between multiple variables of a data frame

后端 未结 3 2025
长发绾君心
长发绾君心 2020-12-31 21:45

I have a data.frame of 10 Variables in R. Lets call them var1 var2...var10

I want to find correlatio

3条回答
  •  温柔的废话
    2020-12-31 22:32

    I think better still, you could get the correlation, not just mapped one variable to all but all variables mapped to all others. You can do that easily with just one line of code. Using the pre-installed mtcars datasets.

    library(dplyr)
    
    cor(select(mtcars, mpg, wt, disp, drat, qsec, hp ))
    

提交回复
热议问题