R/doStat.R

Defines functions doStat

Documented in doStat

#' @title Performing statistics
#' @description performing statistics, including calculating fold change, p-values and VIP values
#' @param x sample ion intensity matrix, row sample, column feature.
#' @param Group sample group information
#' @return a dataframe with statistical information
#' @export
#' @examples
#' dat <- matrix(runif(2*300), ncol = 2, nrow = 300)
#' rownames(dat) <- 1:dim(dat)[1]
#' myGroup <- rep_len(LETTERS[1:3], 300)
#' ret <- doStat(dat, Group = myGroup)

doStat <- function(x, Group = NULL){
  cat("\nPerforming statistics: \n")
  maxSample <- getMax(x)
  myCV <- getCV(x, Group = Group)
  myFC <- getFC(x, Group = Group)
  myP <- getP(x, Group = Group)
  myStat <- cbind(maxSample, myCV, myFC, myP)
  cat("\nStatistical analysis done. \n")
  rownames(myStat) <- colnames(x)
  return(myStat)
}

Try the MSbox package in your browser

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

MSbox documentation built on Dec. 8, 2022, 5:10 p.m.