R/check.inf.R

Defines functions check.inf

#############
# check.inf #
#############

# function to check and replace if some -log10(pval) are +/- Inf.

check.inf <- function(x){
  
  if (sum(is.infinite(x))>0){
    
    # find the maximum value after infinity
    
    max.sc <- max(x[-which(is.infinite(x))])
    
    # replace -infinity by 0
    
    x[((x<0) & is.infinite(x))] <- 0
    
    # replace +infinity by the maximum LOD score value
    
    x[((x>0) & is.infinite(x))] <- max.sc
    
  }
  
  return(x)
  
}

Try the mppR package in your browser

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

mppR documentation built on Jan. 6, 2023, 1:23 a.m.