Skip to content

Instantly share code, notes, and snippets.

@sbfnk
Last active October 27, 2022 11:25
Show Gist options
  • Save sbfnk/f606f396a15360a94029f849afb7ec00 to your computer and use it in GitHub Desktop.
Save sbfnk/f606f396a15360a94029f849afb7ec00 to your computer and use it in GitHub Desktop.
library("devtools")
library("here")
library("socialmixr")
redo <- FALSE
files_file <- here::here("files.rds")
dir.create(here::here("surveys"), showWarnings = FALSE)
if (!file.exists(files_file) || redo) {
ls <- list_surveys()
files <- list()
for (url in ls$url) {
files[[url]] <- download_survey(url, dir = here::here("surveys"))
Sys.sleep(5)
}
saveRDS(files, files_file)
} else {
files <- readRDS(files_file)
}
surveys <- list()
for (url in names(files)) {
cat(url, "\n" )
surveys[[url]] <- load_survey(files[[url]])
}
lapply(surveys, function(x) {
message("Participants ", nrow(x$participant), ", Contacts: ", nrow(x$contact))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment