A wrapper for the data_package_download and data_package_read functions. In some context, combining these functions makes them easier to handle.

data_package_wrapper(data.pkg.doi, download.dir = NULL)

Arguments

data.pkg.doi

(character) Directory where a data package stored. Default (NULL) is the temporary data package directory defined by paste0(tempdir(), 'data_package').

download.dir

(character) Directory to which the data package will be downloaded. Default is the temporary directory specified by paste0(tempdir(), '/data_package').

Value

Returns a list of tibbles containing data and metadata for a given data package. Attributes include information about the doi and download folder.

Details

This function does two things: 1. It combines the data_package_download() and data_package_read() functions into a single function. 2. It assigns attributes to the resulting data package, making it easier to track where the data came from (doi) and where it is stored locally (folder).

Examples

# NOT RUN {
#Download data to a temporary directory and then load it to the global
# environment.
example_package <- data_package_wrapper(data.pkg.doi = 'doi:10.18739/A2DP3X')

#Explicitly download to a temporary directory.
example_package <- data_package_wrapper(data.pkg.doi = 'doi:10.18739/A2DP3X',
  download.dir = tempdir())

#Download and load to current working directory
example_package <- data_package_wrapper(data.pkg.doi = 'doi:10.18739/A2DP3X',
  download.dir = getwd())
# }