Skip to content

Commit

Permalink
Allow for vector input into rowMedians
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremymiller authored Sep 2, 2021
1 parent a3ff2fa commit f870c30
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions R/markerGenesAndMapping.r
Original file line number Diff line number Diff line change
Expand Up @@ -1774,3 +1774,19 @@ getBetaScore <- function(propExpr,
scoreRank <- rank(-betaScore)
scoreRank
}


#' Calculate row medians
#'
#' This is a wrapper for matrixStats::rowMedians that doesn't crash if a vector is provided as input
#'
#' @param x a matrix or vector of values
#'
#' @return if the input is a matrix, return row medians. If a vector, it returns the inputted vector
#'
#' @export
rowMedians <- function(x,...) {
require(matrixStats)
if(is.matrix(x)) return(matrixStats::rowMedians(x,...))
x
}

0 comments on commit f870c30

Please sign in to comment.