R/GetUnzip.R

# Function to extract csv data from a zipped archive
#' @import utils
#' @export GetUnzip
GetUnzip=function(ZipName, FileName) {
  if(grepl('^[hf]t+p', ZipName)) {
    temp <- tempfile()
    download.file(ZipName,temp, quiet=FALSE)
    data <- read.csv(unz(temp, FileName))
    unlink(temp)
  } else {
    data <- read.csv(unz(ZipName, FileName))
  }
  data
}
oharar/rBBS documentation built on May 24, 2019, 11:55 a.m.