I have following matrix wanted to create heatmap in R
E1 E2 P1 P2
E1 1 0.73867 0.865486 0.708944
E2 1 0.749623 0.949532
P1 1 0.747194
P2 1
I used following code to achieve it
acc<-read.csv("data.csv",header=TRUE,sep=",")
row.names(acc)<-acc[,1]
acc <- acc[,2:dim(acc)[2]]
acc_matrix<-data.matrix(acc)
acc_map <- heatmap_2(acc_matrix,Rowv=NA, Colv=NA, col = rev(heat.colors(256)),scale="none",legend=1)
But im getting error as follows
Error in `[.data.frame`(acc, , 1:dim(acc)[1]) :
undefined columns selected
Can anybody please help how to solve this…
Thanks
NI
Here’s one solution using the ggheat function.