R/sizeFactor.R

Defines functions sizeFactor

.sizeFactor <- function(n, useTotal=FALSE) {
  if (useTotal) {
    temp <- log(colSums(n))
    temp <- temp - mean(temp)
    s_size <- exp(temp)
  } else {
    n <- pmax(n,1e-5)
    log_n <- log(n)
    pseudo <- rowMeans(log_n)
    ratio <- log_n-pseudo
    s_size <- exp(apply(ratio,2,median)) }
  return(s_size)
}

Try the QNB package in your browser

Any scripts or data that you put into this service are public.

QNB documentation built on Nov. 17, 2017, 8:09 a.m.