From c0428f880f3933abc7102c24d0449cc84665555a Mon Sep 17 00:00:00 2001 From: "Paul W. Egeler, M.S., GStat" Date: Mon, 24 Jun 2019 13:48:18 -0400 Subject: [PATCH] moved metadata names into a sysdata file --- R/.Rbuildignore | 1 + R/R/REDCap_split.r | 9 +-------- R/R/sysdata.rda | Bin 0 -> 295 bytes R/data-raw/metadata_names.R | 10 ++++++++++ 4 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 R/R/sysdata.rda create mode 100644 R/data-raw/metadata_names.R diff --git a/R/.Rbuildignore b/R/.Rbuildignore index e148253..7f78a9d 100644 --- a/R/.Rbuildignore +++ b/R/.Rbuildignore @@ -2,3 +2,4 @@ ^\.Rproj\.user$ ^\.travis\.yml$ ^appveyor\.yml$ +^data-raw$ diff --git a/R/R/REDCap_split.r b/R/R/REDCap_split.r index 4e45901..14f499d 100644 --- a/R/R/REDCap_split.r +++ b/R/R/REDCap_split.r @@ -87,14 +87,7 @@ REDCap_split <- function(records, metadata) { } # Standardize variable names for metadata - names(metadata) <- c( - "field_name", "form_name", "section_header", "field_type", - "field_label", "select_choices_or_calculations", "field_note", - "text_validation_type_or_show_slider_number", "text_validation_min", - "text_validation_max", "identifier", "branching_logic", "required_field", - "custom_alignment", "question_number", "matrix_group_name", "matrix_ranking", - "field_annotation" - ) + names(metadata) <- metadata_names # Make sure that no metadata columns are factors metadata <- rapply(metadata, as.character, classes = "factor", how = "replace") diff --git a/R/R/sysdata.rda b/R/R/sysdata.rda new file mode 100644 index 0000000000000000000000000000000000000000..0299f29acc10d71483fb818db38ea7f631055462 GIT binary patch literal 295 zcmV+?0oeXRT4*^jL0KkKS;$9c0{{SB|A78E_yGVA5C8-K5J120|KI=tFaY?g4H2Sh zZ&dI|20$7B15l4pXaE2J0iZD{>Zk1$9!*aW(i&vbO+8Q57>y4A9TBww&Itx{-{(C# zxR<*>I61;c!Ey~Db0DD!G$W72+>uTcBr*}%z`*O7dP@KR literal 0 HcmV?d00001 diff --git a/R/data-raw/metadata_names.R b/R/data-raw/metadata_names.R new file mode 100644 index 0000000..30d8c8c --- /dev/null +++ b/R/data-raw/metadata_names.R @@ -0,0 +1,10 @@ +metadata_names <- c( + "field_name", "form_name", "section_header", "field_type", + "field_label", "select_choices_or_calculations", "field_note", + "text_validation_type_or_show_slider_number", "text_validation_min", + "text_validation_max", "identifier", "branching_logic", "required_field", + "custom_alignment", "question_number", "matrix_group_name", "matrix_ranking", + "field_annotation" +) + +usethis::use_data(metadata_names, overwrite = TRUE, internal = TRUE)