简体   繁体   English

无需变换数据帧即可在R中绘制相关矩阵的简便方法

[英]easier way to plot correlation matrix in R without transform data frame

I have a data frame look like: 我有一个数据框看起来像:

> head(mydata)
  V1 V2    V3
1  2 14 0.299
2  2 41 0.284
3  2 71 0.307
4  3 43 0.316
5  3 44 0.366
6  3 84 0.405

my goal is to plot like: 我的目标是像这样绘制: 在此处输入图片说明

It seems that many ways need to transform the data frame to used corrplot or ggcorrplot . 似乎有许多方法需要将数据帧转换为使用的corrplotggcorrplot Is there any way more easier to plot the data frame to correlation matrix without transforming the data frame? 有没有更简单的方法可以将数据帧绘制到相关矩阵而无需转换数据帧?

It does not seem like a lot of transformation is required for the sample data that you have given. 您提供的样本数据似乎不需要大量转换。

library(corrplot)
corrplot(cor(mydata), method="color", outline="White")

Corrplot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM