1

我正在尝试通过从 csv 文件中读取数据来绘制矩阵的热图。以下是代码的外观:

lda <- read.csv('topic_word_matrix.data',sep=",")
row.names(lda) <- lda$topics
lda <- lda[,2:ncol(lda)]
lda_matrix <- data.matrix(lda)
lda_heatmap <- heatmap(lda_matrix, Rowv=NA, Colv=NA,col = cm.colors(256), scale="column", margins=c(5,10))

我的输入文件如下所示:

topics,jockin,limited,raining,magnetic,reallamarodom
topic9,0.0,0.0,0.00671140939597,0.0022271714922,0.00234192037471
topic2,0.1,0.0,0.02671140939597,0.0022271714922,0.00234192037471

我得到一个没有任何颜色的图和以下警告消息:

Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

有谁知道可能出了什么问题?

4

1 回答 1

2

参数 'scale = "columns"' 的错误结果。

您的列的标准差为 0,因此缩放 (mean / sd) 失败。因此,要么使用 scale = "row" 或 scale = "none" ,要么考虑为什么要在列上进行缩放。

高温高压

于 2012-06-27T20:33:18.400 回答