kl散度
(2)dist用法
This function computes and returns the distance matrix computed by using the specified distance measure to compute the distances between the rows of a data matrix.
这个函数用特定的方法计算矩阵的行之间的距离,并返回距离矩阵 。
dist(x, method = "euclidean", diag = FALSE, upper = FALSE, p = 2)
method:可以是"euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski"
diag:是否显示对角线的值
upper:是否显示上三角的值
p:The power of the Minkowski distance
(3)scale用法
scale(x, center = TRUE, scale = TRUE)
step7: scale是对矩阵的每一列进行标准化,如果要对行标准化需要先转置 。如heatmapdata <- t(scale(t(heatmapdata)))
(4)R Script
sampleDist <- dist(t(testdata1))
sampleDistMatrix <- as.matrix(sampleDist)
colnames(sampleDistMatrix) <- NULL
colors <- colorRampPalette(rev(brewer.pal(9,"Blues")))(255)
pheatmap(sampleDistMatrix,
clustering_distance_rows=sampleDist,
clustering_distance_cols=sampleDist,
color = colors)

【R语言怎么做相关性分析】
猜你喜欢
- 怎么测试usb游戏手柄
- PPT怎么抠图不要背景?ppt如何抠图去背景?
- ps无损放大或缩小图片
- 微信锁是什么?怎么用
- 腾讯会议怎么退出账号
- 腾讯会议怎么开启视频
- 怎么修改打印机的名字
- 手机投屏电视怎么全屏
- 腾讯会议怎么发送签到
- 论文引用网页怎么标注
