Reputation: 1569
I am trying to plot heatmap of a matrix by reading data from a csv file. Here is how the code looks:
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))
My input file looks like the following:
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
I get a plot without any color and the following warning messages:
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
Does anyone has any clue what is possibly going wrong?
Upvotes: 1
Views: 1397
Reputation: 13280
The Error result from the Argument 'scale = "columns"'.
Your columns have a standard-deviation of 0, therefore scaling (mean / sd) fails. So either use scale = "row" or scale = "none" or think why do you want to scale on columns.
HTH
Upvotes: 2