Functions to download and unpack a ZIP file into a local folder of files, with very intentional default behaviour. Useful in pedagogical settings or anytime you need a large audience to download a set of files quickly and actually be able to find them.

use_course(url, destdir = NULL)

use_zip(url, destdir = getwd(), cleanup = if (interactive()) NA else FALSE)



Link to a ZIP file containing the materials. Various short forms are accepted, to reduce the typing burden in live settings:

* or shortlinks: "" or ""
* GitHub repo spec: "OWNER/REPO"

Function works well with DropBox folders and GitHub repos, but should work for ZIP files generally. See examples and use_course_details for more.


The new folder is stored here. If NULL, defaults to user's Desktop or some other conspicuous place.


Whether to delete the original ZIP file after unpacking its contents. In an interactive setting, NA leads to a menu where user can approve the deletion (or decline).


Path to the new directory holding the unpacked ZIP file, invisibly.


  • use_course: Designed with live workshops in mind. Includes intentional friction to highlight the download destination. Workflow:

    • User executes, e.g., use_course("").

    • User is asked to notice and confirm the location of the new folder. Specify destdir to prevent this.

    • User is asked if they'd like to delete the ZIP file.

    • If new folder contains an .Rproj file, a new instance of RStudio is launched. Otherwise, the folder is opened in the file manager, e.g. Finder or File Explorer.

  • use_zip: More useful in day-to-day work. Downloads in current working directory, by default, and allows cleanup behaviour to be specified.


if (FALSE) { # download the source of usethis from GitHub, behind a shortlink use_course("") use_course("") ## download the source of rematch2 package, from CRAN and GitHub use_course("") ## from GitHub, 3 ways use_course("r-lib/rematch2") use_course("") use_course("") }