R/attachLibraries.R

Defines functions attachLibraries

Documented in attachLibraries

#' @title Load libraries from libraries file
#' @export
attachLibraries <- function(file_path) {

  libs <- readLines(file_path)

  for(x in libs) {
    pos <- gregexpr("#", x)[[1]][1]

    if (pos == -1) {
      pos = nchar(x) + 1
    }

    res <- substr(x, 1, pos-1)
    res <- sub(" ", "", res)

    if (res != "") {
      require(res, character.only = T)
    }
    outputString(paste("* Attached package:", res))
  }
}
itawaputtytat/puttytat4R documentation built on Jan. 1, 2020, 9:46 a.m.