R/rbind_filelist.R

Defines functions rbind_filelist

Documented in rbind_filelist

#' Bind stored files
#'
#' Rapidly read a list of files from storage and concatenate them by rows.
#'
#' @family general
#' @keywords internal
#' @importFrom data.table fread rbindlist
rbind_filelist <- function(file.list,
                           nThread=1,
                           verbose=TRUE){
    merged.dat <- parallel::mclapply(file.list, function(x){
        messager(x, v = verbose)
        dat <- data.table::fread(x)
        return(dat)
    }, mc.cores = nThread) |> data.table::rbindlist(fill=TRUE)
    return(merged.dat)
}
RajLabMSSM/echofinemap documentation built on Jan. 3, 2023, 1:42 a.m.