R/unzip.R

Defines functions un_zip

Documented in un_zip

#' Unzip files into directory
#'
#' Unzip archive into similarly named directory
#'
#' @param path Name of zipfile. Must end in ".zip"
#' @return Creates a directory in the same folder with the same name (minus the zip part)
#' @export
un_zip <- function(path) {
  stopifnot(grepl("\\.zip$", path))
  out <- sub("\\.zip$", "", path)
  stopifnot(!dir.exists(out))
  dir.create(out)
  utils::unzip(path, exdir = out)
}

Try the tfse package in your browser

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

tfse documentation built on May 2, 2019, 11:28 a.m.