if (FALSE) {
# The token must be a 64-character token
super_token <- redcapConnection(url = "your_redcap_url",
token = "[64-character-super-api-token]")
# Create a new project
createRedcapProject(super_token,
project_title = "New Project Name",
purpose = "Quality Improvement",
is_longitudinal = FALSE,
surveys_enabled = TRUE)
# Copy an existing project into a new project
unlockREDCap(connections = c(rcon = "token_alias"),
url = "your_redcap_url",
keyring = "API_KEYs",
envir = globalenv())
xml_file <- tempfile(file.ext = ".xml")
exportProjectXml(rcon,
file = xml_file)
xml_text <- paste0(readLines(xml_file), collapse = " ")
createRedcapProject(super_token,
xml = xml_text)
}
Run the code above in your browser using DataLab