Learn R Programming

mpathsenser (version 1.2.3)

unzip_data: Unzip m-Path Sense output

Description

[Stable]

Similar to unzip, but makes it easier to unzip all files in a given path with one function call.

Usage

unzip_data(path = getwd(), to = NULL, overwrite = FALSE, recursive = TRUE)

Value

A message indicating how many files were unzipped.

Arguments

path

The path to the directory containing the zip files.

to

The output path.

overwrite

Logical value whether you want to overwrite already existing zip files.

recursive

Logical value indicating whether to unzip files in subdirectories as well. These files will then be unzipped in their respective subdirectory.

Parallel

This function supports parallel processing in the sense that it is able to distribute it's computation load among multiple workers. To make use of this functionality, run future::plan("multisession") before calling this function.

Progress

You can be updated of the progress of this function by using the progressr::progress() package. See progressr's vignette on how to subscribe to these updates.

Examples

Run this code
if (FALSE) {
# Unzip all files in a directory
unzip_data(path = "path/to/zipfiles", to = "path/to/unzipped", recursive = FALSE)

# Unzip all files in a directory and its subdirectories
unzip_data(path = "path/to/zipfiles", to = "path/to/unzipped", recursive = TRUE)

# Unzip specific files
unzip_data(
  path = "path/to/zipfiles",
  to = "path/to/unzipped",
  files = c("file1.zip", "file2.zip")
)

# Unzip files in a directory, but skip those that are already unzipped
unzip_data(path = "path/to/zipfiles", to = "path/to/unzipped", overwrite = FALSE)
}

Run the code above in your browser using DataLab