Learn R Programming

icd (version 3.3)

unzip_to_data_raw: Unzip file to raw data directory

Description

Get a zip file from a URL, extract contents, and save file in the raw data directory. 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 = get_raw_data_dir(),
  save_name = file_name)

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

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 the raw data directory

verbose

single logical value, defaults to FALSE in most functions.

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 the raw data directory. This is helpful for testing without using the internet.

data_raw_path

path where the raw directory is

Value

path of unzipped file in the raw data directory

Details

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