An R function for redcap exports through the API

Here is an R function that exports data from redcap through the API within R. This function, along with new options provided by the redcap API system, applies the metadata to the data via factor levels and variable labels (in Hmisc R package). Will Gray wrote it. Thank him if you see him. This is now maintained on Will's github account.

Scott Burns has written an introduction to redcap's API. His examples use python.

An R Function to process REDCap data exported using the web interface

The function in the attachment list below helps you get a clean R data frame that does not include redundant versions of categorical variables. The function also senses which fields represent dates (yyyy-mm-dd format) and converts them to R Date variables. The inputs are the files created by REDCap for export to R: the .csv file with the data, and the .R file with R code to apply meta data. The function returns a data frame. To get access to the function use require(Hmisc) getRs('importREDCap.r', put='source') # runs source() to define the function The source code for the function may be inspected at https://github.com/harrelfe/rscripts/blob/master/importREDCap.r
Topic revision: r4 - 18 Jan 2016, FrankHarrell
 

This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback