dlr

The goal of dlr is to provide a friendly wrapper around the common pattern of downloading a file if that file does not already exist locally. We also allow for related file-processing tasks, such as processing a local file once into the format you’ll need in the future.

Installation

You can install the released version of dlr from CRAN with:

install.packages("dlr")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("macmillancontentscience/dlr")

Example

This package is intended primarily to be used in other packages. For example, you might have a function in your package like this.

get_foo <- function() {
  # Use dlr to find the cache path. If the file isn't already downloaded, dlr
  # will download it, process it, and save it as an RDS.
  return(
    dlr::read_or_cache(
      source_path = "https://fake.fake/foo.csv",
      appname = "myCoolPackage",
      process_f = read.csv
    )
  )
}

Code of Conduct

Please note that the dlr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Disclaimer

This is not an officially supported Macmillan Learning product.

Contact information

Questions or comments should be directed to Jonathan Bratt (jonathan.bratt@macmillan.com) and Jon Harmon (jonthegeek@gmail.com).