knitr::opts_chunk$set( collapse = TRUE, message = FALSE, comment = "#>" )
This R package provides functions for handling data from the clinical data management system secuTrial. The most important components are related to loading data exports from secuTrial into R. For this vignette and also to test your installation of the R secuTrial package some example export data is delivered with the package. The data (calcium) was retrieved from the lava package and and extended with some made up data (ID 999). Subsequently the dataset was prepared for import into a secuTrial eCRF. After import, the data was again exported and added to the secuTrial R package.
library(secuTrial)
load.tables(data.dir=system.file("extdata", "s_export_rt-CSV-xls_BMD.zip", package = "secuTrial"), decode.rt.visitlabels = TRUE)
The above command loads the rectangular export and writes it into the variable rtdata. Furthermore, the visitlabels are automatically translated if decode.rt.visitlabels is set to TRUE.
load.tables(data.dir=system.file("extdata", "s_export_CSV-xls_BMD.zip", package = "secuTrial"), tables=c("bmd.xls","ctr.xls"))
The above command reads export tables into R variables. The central table in this case is bmd which contains the form data of the bone mineral density dataset. The tables argument has been set to prevent loading of all tables.
bmd_subset <- bmd[,c("pat.id","mnpvispdt","age","grouping","bmd")] names(bmd_subset) # position "grouping" and "bmd" behind "mnpvispdt" bmd_subset_moved_1 <- move.column.after(df=bmd_subset, col.name=c("grouping","bmd"), "mnpvispdt") names(bmd_subset_moved_1) # position "age" back to position 3 with "move.column.to.pos" bmd_subset_moved_2 <- move.column.to.pos(df=bmd_subset_moved_1,col.idx=5,new.col.idx=3) names(bmd_subset_moved_2)
mnppid2mnpaid(1781) mnpaid2mnppid(104)
remove.center.tag("Universitätsspital Basel (SWISS-AF)") remove.center.tag("HUG Genève (SSR)")
mnppid2center(1781) mnppid2center(1781, remove.ctag = 0)
bmd_with_center_col <- add.center(bmd) length(names(bmd)) length(names(bmd_with_center_col))
To asses data completeness of your standard secuTrial export, you first need to generate the "Validation Overview" in secuTrial and export it as an *.xlsx file. Remember to select the "Column" and "Completion status" columns before you export the validation overview.
# load validation overview val_ov <- load_validation_overview(path=system.file("extdata", "bmd_validation_overview.xlsx", package = "secuTrial")) # asses completeness of saved forms saved_form_completeness <- assess_form_variable_completeness(bmd, patient, val_ov, completeness = "savedforms") # asses completeness of all forms (the form can occur up to five times in the visitplan) all_form_completeness <- assess_form_variable_completeness(bmd, patient, val_ov, completeness = "allforms", occ_in_vp = 5)
As you can see below only one age and two grouping and bmd values are missing since the focus is on saved forms. This means that saved forms are mainly complete.
saved_form_completeness
If you look at all forms the data is less complete. The study design allowed the form to be filled up to five times (i.e. five visits). Some of the patients were screened less often and thus the overall data completeness is lower compared to viewing only saved forms.
all_form_completeness
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.