由于内存超载而崩掉的R语言程序的尝试解决方案

0. 情景

当R语言在处理大数据过程中,内存/CPU超载而导致报错的尝试处理方案

1. Core function

rm(list= ls())
.rs.restartR(afterRestartCommand = "")

2. Schemwork

outter_control_fun<-function(){
    source('all related self-defined functions')
    library('all related R packages')
    while(condtion){
        ret<- try(execute_fun(), silent = T)
        if(class(ret) == 'try-error'){
            rm(list = ls())
            source('all related self-defined functions')
            library('all related R packages')
            setup input variables
            .rs.restartR(afterRestartCommand  = "")
        }

    }
}

你可能感兴趣的:(由于内存超载而崩掉的R语言程序的尝试解决方案)