R/read_data.R

Defines functions read_data

Documented in read_data

#' Reads csv files
#'
#' @param path path to file
#' @param type numeric. 1 uses read_csv, 2 uses read_csv2.
#'
#' @return a dataframe.
#'
#' @examples
#' 
#'
#' @export
read_data <- 
  
  function(path, type = 2, ...) {
  
  if(file.exists(path)){
    if(type == 1) return(readr::read_csv(path, ...))
    if(type == 2) return(readr::read_csv2(path, ...))
  }
    }
ktbaek/c19dk documentation built on March 26, 2022, 1:47 a.m.