R/mean_or_0.R

Defines functions mean_or_0

Documented in mean_or_0

#' Helper function to combine technical replicates (only returns mean if all values are > 0)
#'
#' @param x numeric vector
#'
#' @return
#' @export
#'
#' 
mean_or_0 <- function(x) {
  
  # Return 0 if any entry is 0, otherwise the mean of the number
  return(ifelse(any(x == 0), 0, mean(x)))
  
}
nicohuttmann/pOmics documentation built on Sept. 21, 2022, 9:28 a.m.