R/model_paths.R

Defines functions model_paths

Documented in model_paths

#' Set up model paths
#'
#' \code{model_paths} sets up directory paths for model combinations
#'
#' @author M.B. Rudd
#' @param res_dir directory to store results
#' @param modcombos data frame of all model combinations

#' @return vector of directory paths
#' @export
model_paths <- function(res_dir, modcombos){

    devo_path <- function(combo, res_dir){
        old <- res_dir
        for(i in 1:length(combo)){
            new <- file.path(old, combo[i])
            old <- new
            dir.create(old, showWarnings=FALSE)
        }
        return(old)
    }

    alldirs <- sapply(1:nrow(modcombos), function(x) devo_path(combo=modcombos[x,], res_dir=res_dir))

    return(alldirs)
}
merrillrudd/LIME documentation built on June 20, 2020, 2:58 p.m.