R/readFileOrVector.R

Defines functions readFileOrVector

Documented in readFileOrVector

#' readFileOrVector
#'
#' Input: a file name or a character vector. Output: a character vector of the contents of the file, or
#' the character vector unchanged.
#'
#'
#' @param file A file name or a character vector.
#' @return A character vector of the inputs of the file.
#' @author Mika Pflüger
readFileOrVector <- function(file) {
  if (length(file) == 1) {
    if (file == "") return(NULL)
    file <- readLines(file, warn = FALSE)
  }
  return(file)
}

Try the gms package in your browser

Any scripts or data that you put into this service are public.

gms documentation built on June 29, 2024, 9:07 a.m.