Learn R Programming

jwutil (version 1.2.3)

unzip_to_data_raw: Unzip file to data-raw

Description

Get a zip file from a URL, extract contents, and save file in data-raw. If the file already exists there, it is only retrieved if force is set to TRUE. If offline is FALSE, then NULL is returned if the file isn't already downloaded.

Usage

unzip_to_data_raw(url, file_name, force = FALSE, verbose = FALSE,
  offline = TRUE, data_raw_path = "data-raw")

download_to_data_raw(url, file_name = regmatches(url, regexpr("[^/]*$", url)), offline = TRUE, data_raw_path = "data-raw")

Arguments

url

URL of a zip file

file_name

file name of a single file in that zip

force

logical, if TRUE, then download even if already in data-raw

verbose

single logical value, if TRUE then produce verbose messages

offline

single logical, if TRUE then don't pull the file from internet, only return path and file name if the file already exists in data-raw. This is helpful for testing without using the internet.

data_raw_path

path where the data-raw directory is.

Value

path of unzipped file in data-raw

Details

The file name is changed to a conservative cross platform name using make.names