You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the behavior: If an option for a checkbox is proceeded with a space the regular expression for extracting the checkbox choices will omit the option with the leading space and the one before it.
Assume the options for a REDCap checkbox field are set as follows: (note leading space on option 3)
The resulting value in the "select_choices_or_calculations" field will be as follows: (note the missing space a the end of "Adjustment disorder")
"1, Depressive mood disorder | 2, Adjustment disorder| 3, Personality disorder | 4, Anxiety | 0, Not Noted" (note the missing space a the end of "Adjustment disorder"
Calling checkbox_choices() will only return choices 1, 4 and 0.
Expected behavior: All of the checkbox options are returned from checkbox_choices().
Desktop (please complete the following information):
OS: Windows 10
REDCap version 13.7.5
REDCapR Version 1.1.0
Additional context:
Confirmed this behavior with this test case:
test_that("checkbox choices with errant space", {
choices_1 <- "1, Depressive mood disorder | 2, Adjustment disorder| 3, Personality disorder | 4, Anxiety | 0, Not Noted"
ds_boxes <- checkbox_choices(select_choices=choices_1)
ds_expected <- structure(
list(
id = c("1", "4", "0"),
label = c("Depressive mood disorder", "Anxiety", "Not Noted")
),
class = c("tbl_df", "tbl", "data.frame"),
row.names = c(NA, -3L)
)
expect_equal(ds_boxes, expected=ds_expected, label="The returned data.frame should be correct")
expect_s3_class(ds_boxes, "tbl")
})
The text was updated successfully, but these errors were encountered:
BlairCooper
changed the title
Unexpected Behavior: Leading space in Checkbox option causes choices to be omitted
Leading space in Checkbox option causes choices to be omitted
Jul 13, 2023
Describe the behavior: If an option for a checkbox is proceeded with a space the regular expression for extracting the checkbox choices will omit the option with the leading space and the one before it.
Assume the options for a REDCap checkbox field are set as follows: (note leading space on option 3)
The resulting value in the "select_choices_or_calculations" field will be as follows: (note the missing space a the end of "Adjustment disorder")
Calling checkbox_choices() will only return choices 1, 4 and 0.
Expected behavior: All of the checkbox options are returned from checkbox_choices().
Desktop (please complete the following information):
Additional context:
Confirmed this behavior with this test case:
The text was updated successfully, but these errors were encountered: