R/featureTransform.R

featureTransform <- function(DT, logBool, zBool){
    minimumCol <- grep("ExactMass", colnames(DT))
    range <- (minimumCol+1):ncol(DT)

    if(logBool == TRUE){
        for (j in range){
            set(DT, j = j, value = abs(DT[[j]]))
            set(DT, j = j, value = log10(DT[[j]]))
        }
    }
    if(zBool == TRUE){
        DT[,(range) := lapply(.SD, scale), .SDcols = range]
        for (j in range){
            set(DT, j = j, value = scale(DT[[j]]))
        }
    }

    return(DT)
}
jchitpin/blistR documentation built on July 8, 2019, 6:29 p.m.