简体   繁体   中英

How to hide selected correlations for corrplot?

I am new to coding and R. I was trying to visualize a correlation matrix using corrplot , but don't want to show all the correlation values. I wish to hide/cancel a chunk of selected columns and rows correlation values, so only an inverted 'L' of values are shown.

As an example, see edited image of an example corrplot here:

在此输入图像描述

将图中您想要空白的条目设置为相关矩阵(或其副本)中的NA ,然后在调用na.label=" "设置参数na.label=" "

exclude these columns by using indexes, for example

M <- cor( mtcars[ , -c(1, 3, 6)] )
corrplot(M, method = "ellipse")

where we exclude columns 1, 3, 6 (variables mpg, disp, cyl). Other way would be specifying which columns should be evaluated

mtcars[ , c(2:4, 7) ]

takes into account columns 2, 3, 4 and 7. Go through some R tutorial for beginners to familiarize yourself with coding conventions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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