当前位置:网站首页>HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R
2022-07-02 09:38:00 【小宇2022】
df <- mtcars
library(heatmaply)
heatmaply_cor(
cor(df),
xlab = "Features",
ylab = "Features",
k_col = 2,
k_row = 2
)
df <- mtcars
library(heatmaply)
# Compute correlation coefficients
cor.coef <- cor(df)
# Compute correlation p-values
cor.test.p <- function(x){
FUN <- function(x, y) cor.test(x, y)[["p.value"]]
z <- outer(
colnames(x),
colnames(x),
Vectorize(function(i,j) FUN(x[,i], x[,j]))
)
dimnames(z) <- list(colnames(x), colnames(x))
z
}
p <- cor.test.p(df)
heatmaply_cor(
cor.coef,
node_type = "scatter",
point_size_mat = -log10(p),
point_size_name = "-log10(p-value)",
label_names = c("x", "y", "Correlation")
)
library(ggcorrplot)
# Compute a correlation matrix
corr <- round(cor(df), 1)
# Compute a matrix of correlation p-values
p.mat <- cor_pmat(df)
# Visualize the lower triangle of the correlation matrix
# Barring the no significant coefficient
corr.plot <- ggcorrplot(
corr, hc.order = TRUE, type = "lower", outline.col = "white",
p.mat = p.mat
)
corr.plot
library(ggcorrplot)
library(plotly)
# Compute a correlation matrix
corr <- round(cor(df), 1)
# Compute a matrix of correlation p-values
p.mat <- cor_pmat(df)
# Visualize the lower triangle of the correlation matrix
# Barring the no significant coefficient
corr.plot <- ggcorrplot(
corr, hc.order = TRUE, type = "lower", outline.col = "white",
p.mat = p.mat
)
ggplotly(corr.plot)
边栏推荐
猜你喜欢
Redis exceeds the maximum memory error oom command not allowed when used memory & gt; ' maxmemory'
C#多维数组的属性获取方法及操作注意
由粒子加速器产生的反中子形成的白洞
A sharp tool for exposing data inconsistencies -- a real-time verification system
On April 17, 2022, the five heart matchmaker team received double good news
TIPC Cluster5
ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪
TIPC addressing 2
TDSQL|就业难?腾讯云数据库微认证来帮你
Compilation errors and printout garbled problems caused by Chinese content in vs2019 code
随机推荐
II Stm32f407 chip GPIO programming, register operation, library function operation and bit segment operation
制造业数字化转型和精益生产什么关系
每月1号开始计算当月工作日
Thanos Receiver
Win11 arm system configuration Net core environment variable
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
Array splitting (regular thinking
sqlite 修改列类型
Is it safe to open a stock account online? I'm a novice, please guide me
基于Hardhat和Openzeppelin开发可升级合约(一)
Compilation errors and printout garbled problems caused by Chinese content in vs2019 code
Develop scalable contracts based on hardhat and openzeppelin (II)
Eight sorting summaries
C#基于当前时间,获取唯一识别号(ID)的方法
SSRF
Verilog and VHDL signed and unsigned number correlation operations
MySQL comparison operator in problem solving
RPA advanced (II) uipath application practice
Is bond fund safe? Does the bond buying foundation lose principal?
揭露数据不一致的利器 —— 实时核对系统