R/factorize_matrix.R

Defines functions factorize_matrix

Documented in factorize_matrix

#' Divides each row of a matrix by the elements of the specified row
#'
#' @param data expression data
#' @param row reference row
#'
#' @return
#' @export
#'
#'
factorize_matrix <- function(data, row) {
  
  if (!hasArg(data)) stop("No data given.")
  
  if (!hasArg(row)) {
    row <- 1
    message("Using row one as reference.")
  }
  
  t(t(data) / data[row, ])
  
}
nicohuttmann/pOmics documentation built on Sept. 21, 2022, 9:28 a.m.