R/baselineabif.R

Defines functions baselineabif

Documented in baselineabif

baselineabif <- function(rfu, maxrfu = 1000){
    #
    # Check argument:
    #
    if(!is.numeric(rfu)) stop("numerical vector expected for rfu")
    #
    # Do not consider data above threshold maxrfu:
    #
    rfu[rfu >= maxrfu] <- NA
    #
    # Compute a kernel density estimate of data:
    #
    dst <- stats::density(rfu, na.rm = TRUE)
    #
    # Choose as baseline the most common value:
    #
    baseline <- dst$x[which.max(dst$y)]
    return(baseline)
}

Try the seqinr package in your browser

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

seqinr documentation built on May 29, 2024, 6:36 a.m.