0

I need to make a heatmap with only one column of data, I get error message saying "'x' must have at least 2 rows and 2 columns".

How can I make heatmap in R with just one column of data?

This is my code:

`library(gplots)

 getwd()
 x <- read.csv("practise.csv", check.names = FALSE)
 y <- data.matrix(x$utilisation)
 ?heatmap.2

 ?colorRampPalette
 yb <- colorRampPalette((c("green4","grey","blue")))

 heatmap.2(y, col=yb, trace = "none", margins = c(10,12), cexRow=0.7, Colv= 
 FALSE, Rowv = FALSE, key = FALSE)
 `
  • Maybe I misunderstood you, but isn't it so that you actually need an ordinary clustering/dendrogram that indicates the variable value?! – Daniel Fischer Oct 25 '18 at 10:52

1 Answers1

0

You can duplicate your column as work around.

heatmap.2(cbind(y,y), col=yb, trace = "none", margins = c(10,12), cexRow=0.7, Colv= 
 FALSE, Rowv = FALSE, key = FALSEL)
AlienDeg
  • 1,288
  • 1
  • 13
  • 23