if (FALSE) {
unlockREDCap(connections = c(rcon = "project_alias"),
url = "your_redcap_url",
keyring = "API_KEYs",
envir = globalenv())
# Export all events
exportEvents(rcon)
# Export events for a subset of arms
exportEvents(rcon,
arms = c(1, 3))
# Import new events
NewEvents <- data.frame(event_name = c("Event 1",
"Event 2"),
arm_num = c(1, 1))
importEvents(rcon,
data = NewEvents)
# Modify existing events
UpdateEvents <- data.frame(event_name = "Event 2 New Name",
arm_num = 1,
unique_event_name = "event_2_arm_1",
custom_event_label = "The second visit")
importEvents(rcon,
data = UpdateEvents)
# Replace all events with a new set
NewEvents <- data.frame(event_name = c("Event 1",
"Event 2",
"Event 1"),
arm_num = c(1, 1, 2))
importEvents(rcon,
data = NewEvents,
override = TRUE)
# Delete events
deleteEvents(rcon,
events = c("event_1_arm_1", "event_1_arm_2"))
}
Run the code above in your browser using DataLab