inst/unitTests/test_BaseModels.R

test_BaseModels <- function() {

    library(RUnit)
    library(BioMM) 
    ## Load data  
    methylfile <- system.file("extdata", "methylData.rds", package="BioMM")  
    methylData <- readRDS(methylfile)  
    dataY <- methylData[,1]
    ## test a subset of genome-wide methylation data at random
    methylSub <- data.frame(label=dataY, methylData[,c(2:1001)])  
    trainIndex <- sample(nrow(methylSub), 12)
    trainData = methylSub[trainIndex,]
    testData = methylSub[-trainIndex,]
    library(ranger)
    predMode <- "classification"
    paramlist <- list(ntree=300, nthreads=10)
    predY <- baseRandForest(trainData, testData, predMode, paramlist)  
    ## less than two levels for the binary classification predicted output
    checkTrue( nlevels(factor(predY)) <= 2 ) 

}

Try the BioMM package in your browser

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

BioMM documentation built on Nov. 8, 2020, 11:04 p.m.