Created
June 5, 2019 08:52
-
-
Save djnavarro/2f59619e50a90a4d13562dd855f32c8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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