REDCapCAST/README.md

74 lines
6.1 KiB
Markdown
Raw Normal View History

2023-03-08 11:50:44 +01:00
<!-- badges: start -->
2023-06-07 14:03:31 +02:00
[![GitHub R package version](https://img.shields.io/github/r-package/v/agdamsbo/REDCapCAST)](https://github.com/agdamsbo/REDCapCAST)
[![CRAN/METACRAN](https://img.shields.io/cran/v/REDCapCAST)](https://CRAN.R-project.org/package=REDCapCAST)
2023-07-03 07:53:05 +02:00
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8013984.svg)](https://doi.org/10.5281/zenodo.8013984)
2024-06-07 10:58:01 +02:00
[![R-hub](https://github.com/agdamsbo/REDCapCAST/actions/workflows/rhub.yaml/badge.svg)](https://github.com/agdamsbo/REDCapCAST/actions/workflows/rhub.yaml)
2024-06-07 11:02:03 +02:00
[![R-CMD-check](https://github.com/agdamsbo/REDCapCAST/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/agdamsbo/REDCapCAST/actions/workflows/R-CMD-check.yaml)
2023-03-08 12:06:23 +01:00
[![Page deployed](https://github.com/agdamsbo/REDCapCAST/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/agdamsbo/REDCapCAST/actions/workflows/pages/pages-build-deployment)
2023-03-08 11:50:44 +01:00
[![Codecov test coverage](https://codecov.io/gh/agdamsbo/REDCapCAST/branch/master/graph/badge.svg)](https://app.codecov.io/gh/agdamsbo/REDCapCAST?branch=master)
2023-06-07 14:17:07 +02:00
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/REDCapCAST)](https://cran.r-project.org/package=REDCapCAST)
2023-03-09 07:56:05 +01:00
[![Lifecycle:
2023-03-09 07:57:27 +01:00
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
2023-03-08 11:50:44 +01:00
<!-- badges: end -->
# REDCapCAST package <img src="man/figures/logo.png" align="right" />
REDCap database casting and handling of castellated data when using repeated instruments and longitudinal projects.
2022-12-21 08:31:45 +01:00
2024-10-25 10:25:18 +02:00
This package is a fork of [pegeler/REDCapRITS](https://github.com/pegeler/REDCapRITS). The `REDCapRITS` represents great and extensive work to handle castellated REDCap data in different programming languages. This fork is purely minded on R usage and includes a few implementations of the main `REDCap_split` function. The `REDCapRITS` as well as `REDCapCAST` would not be possible without the outstanding work in [`REDCapR`](https://ouhscbbmc.github.io/REDCapR/).
## What problem does `REDCapCAST` solve?
2022-12-21 08:32:38 +01:00
2024-05-23 11:43:59 +02:00
I started working on this project as the castellated longitudinal data set was a little challenging. Later, I have come to learn of the [`redcapAPI`](https://github.com/vubiostat/redcapAPI) package, which would also cover this functionality. I find the `redcapAPI`package quite advanced and a little difficult to work with. This have led to the continued work on this package, as an easy-to-use approach for data migration, data base creation and data handling. This package is very much to be seen as an attempt at a R-to-REDCap-to-R foundry for handling both the transition from dataset/variable list to database and the other way, from REDCap database to a tidy dataset. The goal was also to allow for a "minimal data" approach by allowing to filter records, instruments and variables in the export to only download data needed. I think this approach is desirable for handling sensitive, clinical data. Please refer to [REDCap-Tools](https://redcap-tools.github.io/) for other great tools for working with REDCap in R.
2024-10-25 10:25:18 +02:00
For any more advanced uses, consider using the [`redcapAPI`](https://github.com/vubiostat/redcapAPI) or [`REDCapR`](https://ouhscbbmc.github.io/REDCapR/) packages.
2023-04-13 10:57:04 +02:00
2024-11-15 20:47:23 +01:00
What is unique in this package, is the work towards making it a lot easier to move data from different sources to REDCap databases: casting REDCap metadata based on a spreadsheet. This is all wrapped in `shiny_cast()`and [hosted for all to use here](https://agdamsbo.shinyapps.io/redcapcast/).
2024-10-25 10:25:18 +02:00
## Main functionality
2023-04-13 10:57:04 +02:00
2024-02-27 12:43:54 +01:00
Here is just a short description of the main functions:
2023-04-13 10:57:04 +02:00
* `REDcap_split()`: Works largely as the original `REDCapRITS::REDCap_split()`. It takes a REDCap dataset and metadata (data dictionary) to split the data set into a list of dataframes of instruments.
2024-02-27 12:43:54 +01:00
* `read_redcap_tables()`: wraps the use of [`REDCapR::redcap_read()`](https://github.com/OuhscBbmc/REDCapR) with `REDCap_split()` to ease the export of REDCap data. Default output is a list of data frames with one data frame for each REDCap instrument.
2023-04-13 10:57:04 +02:00
2024-02-27 12:43:54 +01:00
* `redcap_wider()`: joins and pivots a list of data frames with repeated instruments to a wide format utilizing the [`tidyr::pivot_wider()`](https://tidyr.tidyverse.org/reference/pivot_wider.html) from the [tidyverse](https://www.tidyverse.org/).
2023-04-13 10:57:04 +02:00
2023-12-20 16:01:23 +01:00
* `easy_redcap()`: combines secure API key storage with the `keyring`-package, focused data retrieval and optional widening. This is the recommended approach for easy data access and analysis.
2024-02-27 12:43:54 +01:00
* `ds2dd_detailed()`: Converts a data set to a data dictionary for upload to a new REDCap database. Variables (fields) and instruments in a REDCap data base are defined by this data dictionary.
2024-06-07 10:58:01 +02:00
* `doc2dd()`: Converts a document table to data dictionary. This allows to specify instrument or whole data dictionary in text document, which for most is easier to work with and easily modifiable. Very much like a easy version of just working directly in the data dictionary file itself.
2024-11-15 20:47:23 +01:00
* `shiny_cast()`: [Shiny](https://shiny.posit.co/) application to ease the process of converting a spreadsheet/data set to a REDCap database. The app runs locally and data is transferred securely. You can just create and upload the data dictionary, but you can also transfer the given data in the same process. The app is [hosted on shinyapps.io](https://agdamsbo.shinyapps.io/redcapcast/).
2023-04-13 10:57:04 +02:00
## Future
2024-02-27 12:43:54 +01:00
The plan with this package is to be bundled with a Handbook on working with REDCap from R. This work is in progress but is limited by the time available. Please feel free to contact me or create and issue with ideas for future additions.
2023-04-13 10:57:04 +02:00
## Installation
2023-12-20 14:47:57 +01:00
The package is available on CRAN. Install the latest version:
```
install.packages("REDCapCAST")
```
2023-04-13 10:57:04 +02:00
Install the latest version directly from GitHub:
```
2024-09-05 13:30:02 +02:00
require("remotes")
remotes::install_github("agdamsbo/REDCapCAST")
2023-04-13 10:57:04 +02:00
```
2022-12-21 08:31:45 +01:00
Launch the REDCapCAST app interface directly on your own machine:
```
REDCapCAST::shiny_cast()
```
2024-02-27 14:18:23 +01:00
## Code of Conduct
Please note that the REDCapCAST project is released with a [Contributor Code of Conduct](https://agdamsbo.github.io/REDCapCAST/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.