Skip to content

Commit

Permalink
feat: handle single k case
Browse files Browse the repository at this point in the history
sapply returns a numeric vector, make it a single row matrix so
downstream code works as expected
  • Loading branch information
ESCRI11 committed Oct 16, 2024
1 parent e52cbda commit 92f93ac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/board.clustering/R/clustering_plot_genemodule.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ clustering_plot_genemodule_server <- function(id,
mat <- res$mat
idx <- res$idx
modx <- sapply(1:ncol(mat), function(i) tapply(mat[, i], idx, mean))
if (is.null(dim(modx))) {
modx <- matrix(modx, nrow = 1)
rownames(modx) <- unique(idx)
}
colnames(modx) <- colnames(mat)

return(list(
Expand Down

0 comments on commit 92f93ac

Please sign in to comment.