This is an R package for exporting your data from Castor Electronic Data Capture (EDC) to R. It makes use of the Python wrapper under the hood (https://github.com/reiniervlinschoten/castoredc_api).
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("reiniervlinschoten/castoredc_api-R")
Then you can export your data from Castor EDC with three lines of code. First create and start the necessary Python environment. If this already exists, this will start and update the Python environment. Then you can download your study data for analysis. For downloading you need your client-ID and client-secret (don't share these!), study-ID and url to the server. client-ID and client-secret: Account -> Settings -> Castor EDC API study-ID: Study -> Settings -> Castor Study ID url: region*.castoredc.com
For exporting data: The endpoint that extracts data for the study can't be used if the authenticated user has a role within the study. See: https://data.castoredc.com/api#/export/get_studystudy_idexport_data
library(CastorEDCApi)
# Create/Start Python environment, do this whenever you start a new R session
configure_python()
# Exports data
dataframes <- export_data('MYCLIENTID', 'MYCLIENTSECRET', 'MYSTUDYID', 'data.castoredc.com')
During the same R session, you can reexport your data by just running the below code.
# Exports data
dataframes <- export_data('MYCLIENTID', 'MYCLIENTSECRET', 'MYSTUDYID', 'data.castoredc.com')
If an error occurs, this can be because your Python environment is not setup correctly. First try setting up your Python environment:
library(CastorEDCApi)
# Create/Start Python environment, do this whenever you start a new R session
configure_python()
If that doesn't work, copy the error with the output from the below functions and open an issue detailing your error.
reticulate::py_discover_config()
reticulate::conda_list()
Date fields are returned as strings (dd-mm-yyyy) Datetime fields are returned as strings (dd-mm-yyyy hh-mm) Numeric fields are all returned as floats.
Missing data is mostly handled through standard NA.
User-defined missing data is handled through its definitions in Castor. For numeric and text-like variables, these values are -95, -96, -97, -98 and -99. For datetime data, missing data values are with the years 2995, 2996, 2997, 2998, and 2999.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.