REDCapR v0.11.0
Monthly downloads
Interaction Between R and REDCap
Encapsulates functions to streamline calls from R to the REDCap
API. REDCap (Research Electronic Data CAPture) is a web application for
building and managing online surveys and databases developed at Vanderbilt
University. The Application Programming Interface (API) offers an avenue
to access and modify data programmatically, improving the capacity for
literate and reproducible programming.
Readme
REDCapR 
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():
ds <- redcap_read(redcap_uri=uri, token=token)$data
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
desired_records <- c(1, 4)
ds_some_rows <- redcap_read(
redcap_uri = uri,
token = token,
records = desired_records
)$data
# Return only the fields record_id, name_first, and age
desired_fields <- c("record_id", "name_first", "age")
ds_some_fields <- redcap_read(
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.
Installation and Documentation
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.
remotes::install_github(repo="OuhscBbmc/REDCapR")
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.
Collaborative Development
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.
Funders
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 http://ouhscbbmc.github.io/MReportingPublic/.
- OUHSC CCAN Independent Evaluation of the State of Oklahoma Competitive Maternal, Infant, and Early Childhood Home Visiting (MIECHV) Project. HRSA/ACF D89MC23154. David Bard, PI, OUHSC; 2011-2015.
- Independent Evaluation of the State of OK MIECHV Evidence Based Home Visitation Project, NIH-sponsored collaboration with OSDH. David Bard, PI, OUHSC; 2015-2017.
- OSDH ParentPRO Pilot Evaluation, federally-sponsored collaboration with OSDH. David Bard, PI, OUHSC; 2015-2017.
- Title IV-E Waiver Project, HRSA/MCHB-sponsored collaboration with OKDHS; David Bard, PI, OUHSC; 2014-2017.
- Integrative Analysis of Longitudinal Studies of Aging (IALSA), sponsored by NIH 5P01AG043362. Scott Hofer, PI, University of Victoria; Will Beasley, PI of site-award, OUHSC; 2013-2018.
- Oklahoma Shared Clinical and Translational Resources, sponsored by NIH NIGMS; U54 GM104938. Judith A. James, PI, OUHSC; 2013-2018.
- Additional Institutional Support from OUHSC Dept of Pediatrics; 2013-2017.
Thanks,
Will Beasley, David Bard, & Thomas Wilson
University of Oklahoma Health Sciences Center,
Department of Pediatrics,
Biomedical & Behavioral Research Core.
Build Status and Package Characteristics
| GitHub | Travis-CI | AppVeyor | Coveralls | Codecov |
|---|---|---|---|---|
| Master | ||||
| Dev | ||||
| Ubuntu LTS | Windows Server | Test Coverage | Test Coverage |
| Key | Value |
|---|---|
| License | |
| CRAN Version | |
| CRAN Rate | |
| Zenodo Archive | |
| Production Doc | |
| Development Doc |
Functions in REDCapR
| Name | Description | |
| kernel_api | REDCapR internal function for calling the REDCap API | |
| create_batch_glossary | Creates a dataset that help batching long-running read and writes | |
| redcap_download_file_oneshot | Download a file from a REDCap project record | |
| metadata_utilities | Manipulate and interpret the metadata of a REDCap project | |
| redcap_download_instrument | Download REDCap Instruments | |
| REDCapR-package | R utilities for interacting with a REDCap data system http://www.project-redcap.org/ | |
| constant | Collection of REDCap-specific constants | |
| redcap_column_sanitize | Sanitize to adhere to REDCap character encoding requirements | |
| redcap_metadata_read | Export the metadata of a REDCap project | |
| collapse_vector | Collapse a vector of values into a single string when necessary | |
| redcap_metadata_write | Import metadata of a REDCap project | |
| redcap_survey_link_export_oneshot | Download a file from a REDCap project record | |
| redcap_upload_file_oneshot | Upload a file into to a REDCap project record | |
| retrieve_credential | Read a token and other credentials from a (non-REDCap) database or file | |
| sanitize_token | Validate and sanitize the user's REDCap token | |
| redcap_write_oneshot | Write/Import records to a REDCap project | |
| redcap_project | A Reference Class to make later calls to REDCap more convenient | |
| replace_nas_with_explicit | Create explicit factor level for missing values | |
| redcap_read | Read records from a REDCap project in subsets, and stacks them together before returning a dataset | |
| redcap_next_free_record_name | Determine free available record ID | |
| redcap_read_oneshot | Read/Export records from a REDCap project | |
| redcap_users_export | List authorized users | |
| redcap_version | Determine version of REDCap instance | |
| redcap_variables | Enumerate the exported variables | |
| redcap_write | Write/Import records to a REDCap project | |
| redcap_read_oneshot_eav | Read/Export records from a REDCap project --still in development | |
| validate | Inspect a dataset to anticipate problems before writing to a REDCap project | |
| No Results! | ||
Vignettes of REDCapR
Last month downloads
Details
| URL | https://github.com/OuhscBbmc/REDCapR, http://ouhsc.edu/bbmc/, http://project-redcap.org |
| BugReports | https://github.com/OuhscBbmc/REDCapR/issues |
| License | GPL-2 |
| LazyData | TRUE |
| VignetteBuilder | knitr |
| Encoding | UTF-8 |
| RoxygenNote | 7.1.0 |
| NeedsCompilation | no |
| Packaged | 2020-04-21 06:10:42 UTC; wibeasley |
| Repository | CRAN |
| Date/Publication | 2020-04-22 00:10:02 UTC |
| imports | checkmate (>= 2.0) , dplyr (>= 0.8.0) , httr (>= 1.4.0) , magrittr (>= 1.5) , methods , readr (>= 1.3.1) , rlang (>= 0.4) , tibble (>= 2.0) , tidyr (>= 1.0) |
| suggests | covr (>= 3.4) , DBI (>= 1.1) , kableExtra (>= 1.0) , knitr (>= 1.18) , odbc (>= 1.1.1) , rmarkdown (>= 2.0) , sessioninfo (>= 1.1.1) , testthat (>= 2.0) |
| depends | R (>= 3.0.0) |
| Contributors | David Bard, Benjamin Nutter, Thomas Wilson, Andrew Peters, John J Aponte, Rollie Parrish, Hao Zhu, Felix Torres, Philip Chase |
Include our badge in your README
[](http://www.rdocumentation.org/packages/REDCapR)