我试图通过从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
有没有人知道可能出现的问题?
答案 0 :(得分:2)
参数&#39; scale =&#34;列的错误结果&#34;&#39;。
您的列的标准偏差为0,因此缩放(均值/标准差)失败。 所以要么使用scale =&#34; row&#34;或scale =&#34; none&#34;或者想想为什么要扩展列。
HTH