相关性热图的完美解决方案 – pheatmap包
install.packages('pheatmap')# 安装包,加载数据
library(pheatmap)
# 生成测试数据集
test = matrix(rnorm(200),20,10)
# 取出1-10行,13579列,全部加3
test[1: 10, seq(1,10,2)] = test[1:10, seq(1, 10,2)]+3
# 取出11-20行,246810列,全部加1
test[11: 20, seq(2,10,2)] = test[11:20, seq(2, 10,2)]+1
# 取出15-20行,246810列,全部加5
test[15:20, seq(2,10,2)] = test[15:20, seq(2,10,2)]+5
> head(test)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 5.862158 1.0025110 4.643383 1.3927443 3.078703 -0.70255575
[2,] 2.170332 0.9238553 3.270871 -1.5441517 2.466412 2.79953282
[3,] 3.214988 0.8554705 3.535641 -0.1205533 3.057674 0.53514690
[4,] 2.112973 -0.3915936 3.574049 0.1224274 2.816445 0.02743305
[5,] 3.875925 0.1835678 4.237681 -1.1217373 4.015698 -1.19018925
[6,] 4.492317 -1.362436