mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-10-30 03:21:53 +01:00
moving instrument status fields ahead of checkboxes and factors
This commit is contained in:
parent
3f891fcfef
commit
0b04c8a61d
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user