From 0515d6f8ed02671964146de96f578204c0490004 Mon Sep 17 00:00:00 2001 From: Chris Sobczak Date: Mon, 6 Jul 2026 16:37:25 -0700 Subject: Fix --- R/heatmap.R | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'R/heatmap.R') 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] } } -- cgit v1.2.3