Setup
This is how you get REDCap turned into an R database…
library(REDCapSync)
projects <- get_projects() # get list of cached projects
View(projects) # show your previously saved projects
You can set your REDCap token in two ways! If you need more help setting your tokens see this article –> placeholder
#1. set each time in your session (not recommended in saved/shared scripts!)
Sys.setenv(REDCapSync_TEST1 = "YoUrNevErShaReToken")
#2. set to your private R sessions!
usethis::edit_r_environ() #finds your file
# Then you add --> REDCapSync_TEST = 'YoUrNevErShaReToken'
# then save file and restart R
# If it worked you will see your token when you run...
Sys.getenv("REDCapSync_TEST1")
Run Core Functions
The following functions represent the core functions of the package.
project <- setup_project(
short_name = "TEST1", #must match token pattern REDCapSync_****
redcap_base = "https://redcap.miami.edu/", # change to your institutions link
dir_path = getwd(), # or change to your intended file path
)
project <- sync_project(project)