Skip to content
R function to download the Plan S feedback files
Branch: master
Clone or download
Latest commit 50f72e5 Jun 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Jun 20, 2019
README.md Update README.md Jun 20, 2019
feedback-viz.R Update script Jun 22, 2019

README.md

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.