R/loadL2Object.R

Defines functions loadL2Object

########################################################################################################################
loadL2Object <- function() {
    data_path <- readRDS(DATA_PATH_FILE_LOCATION)
    level2_file <- dir(data_path, pattern = "Level2.rds$", full.names = TRUE, recursive = TRUE)
    tryCatch(.Object <- readRDS(file = level2_file),
             error = function(e) {
                 stop("Data directory does not seem to be initialized.\n",
                      "Either connect to an existing Level2-Location (S4Level2::connectToExistingDataLocation)\n",
                      "or create a new one (S4Level2::initializeDataLocation)")
             }
    )
    return(.Object)
}
Sumpfohreule/S4Level2 documentation built on Dec. 18, 2021, 3:04 p.m.