summaryrefslogtreecommitdiff
path: root/R/heatmap.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/heatmap.R')
-rw-r--r--R/heatmap.R12
1 files changed, 4 insertions, 8 deletions
diff --git a/R/heatmap.R b/R/heatmap.R
index cf34d5f..1438fd3 100644
--- a/R/heatmap.R
+++ b/R/heatmap.R
@@ -29,13 +29,11 @@ heatmap <- function(R, title = NULL, labels = FALSE, order = NULL){
stop('Input must be coercible to a square matrix')
}
- cnames <- colnames(Rm)
- rnames <- rownames(Rm)
- if(is.null(cnames)){
- cnames <- as.character(seq_len(ncol(Rm)))
+ if(is.null(colnames(Rm))){
+ colnames(Rm) <- as.character(seq_len(ncol(Rm)))
}
- if(is.null(rnames)){
- rnames <- as.character(seq_len(nrow(Rm)))
+ if(is.null(rownames(Rm))){
+ rownames(Rm) <- as.character(seq_len(nrow(Rm)))
}
@@ -43,8 +41,6 @@ heatmap <- function(R, title = NULL, labels = FALSE, order = NULL){
if(length(order) != nrow(Rm)){
stop('Provided order is not the same length as the width of R')
}else{
- rownames(Rm) <- rnames
- colnames(Rm) <- cnames
Rm <- Rm[order, order, drop = FALSE]
}
}