R/access_data.R

#' Lists all the available model results
#' @param result_folder The folder containing the results of runs
#' @export

list_all_results <- function(result_folder){
  all_files <- list.files(result_folder, pattern = ".*tbl.*mdb")
  all_files <- file.path(result_folder, all_files)
  return(all_files)  
}

#' Creates a connection to an Access database
#' @param path_to_db The absolute path to the database file containing the results
#' @export

access_database <- function(path_to_db){
  channel <- odbcConnectAccess(path_to_db)
  return(channel)
}

#' Lists all the result tables produced by modgen
#' @param channel A connection to the Access database
#' @export

list_result_tables <- function(channel){
  data <- as.character(sqlQuery(channel, 'SELECT Name from TableDic')[,1,TRUE])
  return(data)
}

#' Lists all the parameter tables produced by modgen
#' @param channel A connection to the Access database
#' @export

list_parameter_tables <- function(channel){
  data <- as.character(sqlQuery(channel, 'SELECT Name from ParameterDic')[,1,TRUE])
  return(data)
}
philliplab/modgenTester documentation built on May 25, 2019, 5:06 a.m.