if (FALSE) {
unlockREDCap(connections = c(rcon = "project_alias"),
url = "your_redcap_url",
keyring = "API_KEYs",
envir = globalenv())
# Save a project to the current session
projectData <- preserveProject(rcon)
# Save a project to an Rdata file
save_to_dir <- tempdir()
preserveProject(rcon,
save_as = "Rdata",
dir = save_to_dir)
# Create an offline connection from the Rdata file
load(file.path(save_to_dir,
"project-[project_id]-RedcapList.Rdata"))
off_conn <- readPreservedProject(RedcapList,
version = "[redcap_api_version]",
url = "[redcap_api_url]")
# Save a project to CSV files
save_to_dir <- tempdir()
preserveProject(rcon,
save_as = "csv",
dir = save_to_dir)
# Create an offline connection from the CSV files
off_con <-
readPreservedProject(save_to_dir,
version = "[redcap_api_version]",
url = "[redcap_api_url]")
}
Run the code above in your browser using DataLab