We’ve been using R with REDCap’s API since 2012 and have
developed REDCapR
.
Before encapsulating these functions in a package, we were replicating
50+ lines of code to contact REDCap and robustly transform the returned
csv
into an R data.frame
; it took twice that much to implement
batching. All this can be done in one call to redcap_read()
:
<- redcap_read(redcap_uri=uri, token=token)$data ds
The redcap_read()
function also accepts values for subsetting/filtering the records and
fields. Here are two examples; the first selects only a portion of the
rows, while the second selects only a portion of the columns.
Documentation for the additional 20+ functions are found at ouhscbbmc.github.io/REDCapR/reference.
# Return only records with IDs of 1 and 4
<- c(1, 4)
desired_records <- redcap_read(
ds_some_rows redcap_uri = uri,
token = token,
records = desired_records
$data
)
# Return only the fields record_id, name_first, and age
<- c("record_id", "name_first", "age")
desired_fields <- redcap_read(
ds_some_fields redcap_uri = uri,
token = token,
fields = desired_fields
$data )
The REDCapR
package includes the SSL certificate
retrieved by httr::find_cert_bundle()
.
Your REDCap server’s identity is always verified, unless the setting is
overridden (alternative certificates can also be provided).
To keep our maintenance efforts manageable, the package implements only the REDCap API functions that have been requested. If there’s a feature that would help your projects, please tell us in a new issue in REDCapR’s GitHub repository. A troubleshooting document helps diagnose issues with the API.
The release version can be installed from CRAN.
install.packages("REDCapR")
The development version can be installed from GitHub after installing
the remotes
package.
install.packages("remotes") # Run this line if the 'remotes' package isn't installed already.
::install_github("OuhscBbmc/REDCapR") remotes
The ouhscbbmc.github.io/REDCapR site describes the package functions, and includes documents involving basic operations, advanced operations, token security, and troubleshooting.
Also checkout the other packages that exist for communicating with REDCap, which are listed in the REDCap Tools directory.
We encourage input and collaboration. If you’re familiar with GitHub
and R packages, feel free to submit a pull request. If
you’d like to report a bug or make a suggestion, please create a GitHub
issue; issues
are a usually a good place to ask public questions too. However, feel
free to email Will
(wibeasley@hotmail.com).
Please note that this project is released with a Contributor
Code of Conduct; by participating in this project you agree to abide
by its terms. We have some starting material described in the ./documentation-for-developers/
directory.
We’d like to thank the following developers for their advice and code contributions: Benjamin Nutter, Rollie Parrish, Scott Burns, John Aponte, Andrew Peters, and Hao Zhu.
Much of this package has been developed to support the needs of the following projects. We appreciate the support. (So far) the primary developers of REDCapR are the external evaluators for Oklahoma’s MIECHV program. See the preliminary CQI reports (many of which use REDCapR) at https://ouhscbbmc.github.io/MReportingPublic/.
Thanks, Will
Beasley, David
Bard, & Thomas Wilson
University of Oklahoma Health Sciences
Center, Department
of Pediatrics, Biomedical
& Behavioral Research Core.
Branch | GitHub Actions | Codecov |
---|---|---|
Main | ||
Dev | ||
Ubuntu Latest | Test Coverage |
Key | Value |
---|---|
License | |
CRAN Version | |
CRAN Rate | |
Zenodo Archive | |
Production Doc | |
Development Doc |