R/scalematrix.R

Defines functions scalematrix

#' Standardize the values by rows
#'
#' This function standardize the values for a matrix by its rows
#'
#' @return a gene by cell (or pseudotime) expression matrix
#' @author Wenpin Hou <whou10@jhu.edu>
#' @param data a matrix.

scalematrix <- function(data) {
  cm <- rowMeans(data)
  csd <- apply(data, 1, sd)
  (data - cm) / csd
}
Winnie09/Lamian documentation built on Nov. 19, 2024, 7:04 p.m.