Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (20 sloc) 1.22 KB

Plan S feedback files

The R function below allows you to automatically download all Plan S feedback files from Zenodo at once.

How to download the files

Requirements

Before executing the code you have to create a new R project and manually create an empty folder called 'files' within the project directory. Alternatively, you can simply change the destination paths to match an existing directory of your choice.

Create URLs and destination paths

# Create URLs
seq <- sprintf("%03.0f", 44:607)
urls <- paste0("https://zenodo.org/record/3250081/files/", seq, "_Plan S.pdf")

# Create destination paths
MAIN_DIR <- rprojroot::find_rstudio_root_file()
destinations <- paste0(MAIN_DIR, "/files/", seq, ".pdf")

Download feedback files into 'files' folder

Please note that the numbering of the feedback files isn't consecutive, i.e. not all of the URLs created above exist. Hence, tryCatch() first checks whether each individual URL exists and then download.file() only downloads the valid files without throwing errors.

# Download files
Map(function(url, destfile) tryCatch(download.file(url, destfile, mode = "wb"), error = function(e) 1), urls, destinations)
You can’t perform that action at this time.