Last active
May 4, 2023 14:53
-
-
Save spgarbet/650b88332ca867e3f0ec087f31cc59e5 to your computer and use it in GitHub Desktop.
exportBulkRecords example interface
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
unlockREDCap(c(test_conn = 'TestRedcapAPI', | |
sandbox_conn = 'SandboxAPI'), | |
keyring = 'MyKeyring', | |
envir = globalenv(), | |
url = 'https://<REDCAP_URL>/api/') | |
# After user interaction to unlock the local encrypted keyring | |
# the global environment will contain the REDCap connections | |
# `test_conn` and `sandbox_conn` | |
# | |
# Next the user wants to bulk specify importing all the forms | |
# of interest and post process | |
exportBulkRecords( | |
rcon = list(test = test_conn, | |
sand = sandbox_conn), | |
forms = list(test = c('form1', 'form2'), | |
envir = globalenv(), | |
post = function(Records, rcon) { | |
Records |> | |
mChoiceCast(rcon) |> | |
guessDat(rcon) |> | |
widerRepeating(rcon) | |
} | |
) | |
# The environment now contains the data.frames: `test.form1`, `test.form2`, `sand`. | |
# Each of these were retrieved, possibly using the forms argument and all were | |
# post processed in the same manner as specified by `post`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment