R/addRI.R

Defines functions addRI

Documented in addRI

## RIstandards is a two-column matrix, column 1 containing the RI, column 2 the corresponding retention time. Only if RI is
## not already there.
addRI <- function(mspobj, RIstandards, isMSP = TRUE) {
    if (isMSP) {
        lapply(mspobj, function(obj) {
            if (is.null(obj$RI)) 
                obj$RI <- round(approx(RIstandards[, "rt"], RIstandards[, "RI"], obj$rt)$y)
            obj
        })
    } else {
        lapply(mspobj, function(obj) {
            cbind(obj, RI = round(approx(RIstandards[, "rt"], RIstandards[, "RI"], obj[, "rt"])$y))
        })
    }
}

Try the metaMS package in your browser

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

metaMS documentation built on Nov. 8, 2020, 8:21 p.m.