View source: R/REDCap_coltype_check.R
| REDCap_coltype_check | R Documentation |
Uses REDCap codebook metadata to infer expected classes and compares these to
classes in data.
REDCap_coltype_check(
codebook,
indicator_POSIXct = "datetime_dmy",
indicator_date = "Date",
indicator_time = "time",
indicator_logical = "yesno",
indicator_numeric.val_col = c("number", "integer"),
indicator_numeric.type_col = c("radio", "dropdown"),
label_col = `Field Label`,
name_col = `Variable / Field Name`,
type_col = `Field Type`,
val_col = `Text Validation Type OR Show Slider Number`,
data
)
codebook |
REDCap data dictionary. |
indicator_POSIXct |
Indicator in |
indicator_date |
Pattern used in labels to identify date variables. |
indicator_time |
Indicator in |
indicator_logical |
Indicator in |
indicator_numeric.val_col |
Indicators in |
indicator_numeric.type_col |
Indicators in |
label_col |
Unquoted codebook label column. |
name_col |
Unquoted codebook variable-name column. |
type_col |
Unquoted codebook field-type column. |
val_col |
Unquoted codebook validation/type-hint column. |
data |
Data frame to validate. |
A list with ok, summary, and per-column details.
library(gt)
dict_path <- system.file("ext", "DataDictionary_sleepdiary.csv",
package = "melidosData"
)
dict <- utils::read.csv(dict_path, check.names = FALSE)
coltype_check <- REDCap_coltype_check(dict, data = REDCap_example_sleep)
coltype_check$ok
coltype_check$summary
coltype_check$details |> gt()
dict_path <- system.file("ext", "DataDictionary_chronotype.csv",
package = "melidosData"
)
dict <- utils::read.csv(dict_path, check.names = FALSE)
dict <- REDCap_codebook_prepare(dict, form.filter = "mctq")
coltype_check <- REDCap_coltype_check(dict, data = REDCap_example_chronotype)
coltype_check$ok
coltype_check$summary
coltype_check$details
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.