Skip to content

Instantly share code, notes, and snippets.

@djnavarro
Created June 5, 2019 08:52
Show Gist options
  • Save djnavarro/2f59619e50a90a4d13562dd855f32c8a to your computer and use it in GitHub Desktop.
Save djnavarro/2f59619e50a90a4d13562dd855f32c8a to your computer and use it in GitHub Desktop.
# authenticate using OSF token stored in .Renviron
osfr::osf_auth()
# define download function
download_project <- function(node, path) {
proj <- osfr::osf_retrieve_node(node)
files <- osfr::osf_ls_files(proj)
if(!dir.exists(path)) dir.create(path)
for(i in 1:nrow(files)) {
cat("downloading: ", files$name[i], "\n")
osfr::osf_download(files[i,], file.path(path, files$name[i]))
}
}
# the devil and deep blue sea OSF project:
# https://osf.io/5swnm/
download_project(node = "5swnm", path = "~/Desktop/devil")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment