moving instrument status fields ahead of checkboxes and factors

This commit is contained in:
Egeler, Paul W 2018-06-04 20:51:57 -04:00
parent 3f891fcfef
commit 0b04c8a61d

View File

@ -72,6 +72,16 @@ REDCap_split <- function(records, metadata) {
c("field_name", "form_name") c("field_name", "form_name")
] ]
# Process instrument status fields
form_names <- unique(metadata$form_name)
form_complete_fields <- data.frame(
field_name = paste0(form_names, "_complete"),
form_name = form_names,
stringsAsFactors = FALSE
)
fields <- rbind(fields, form_complete_fields)
# Process checkbox fields # Process checkbox fields
if (any(metadata$field_type == "checkbox")) { if (any(metadata$field_type == "checkbox")) {
@ -101,16 +111,6 @@ REDCap_split <- function(records, metadata) {
} }
# Process form_complete fields
form_names <- unique(metadata$form_name)
form_complete_fields <- data.frame(
field_name = paste0(form_names, "_complete"),
form_name = form_names,
stringsAsFactors = FALSE
)
fields <- rbind(fields, form_complete_fields)
# Process ".*\\.factor" fields supplied by REDCap's export data R script # Process ".*\\.factor" fields supplied by REDCap's export data R script
if (any(grepl("\\.factor$", names(records)))) { if (any(grepl("\\.factor$", names(records)))) {
@ -135,6 +135,7 @@ REDCap_split <- function(records, metadata) {
) )
fields <- rbind(fields, factor_fields) fields <- rbind(fields, factor_fields)
} }
# Identify the subtables in the data # Identify the subtables in the data