A zero-coded check field is a field of the REDCap type checkbox
that has
a coding definition of 0, [label]
. When exported, the field names for
these fields is [field_name]___0
. As in other checkbox fields, the
raw data output returns binary values where 0 represent and unchecked
box and 1 represents a checked box. For zero-coded checkboxes, then, a
value of 1 indicates that 0 was selected.
This coding rarely presents a problem when casting from raw values
(as is done in exportRecordsTyped
). However, casting from coded or
labeled values can be problematic, as it In this case, it becomes
indeterminate from context if the intent of 0
is 'false' or the coded
value '0' ('true') ...
The situations in which casting may fail to produce the desired results are
Code | Label | Result |
0 | anything other than "0" | Likely to fail when casting from coded values |
0 | 0 | Likely to fail when casting from coded or labeled values |
Because of the potential for miscast data, casting functions will issue
a warning anytime a zero-coded check field is encountered. A separate
warning is issued when a field is cast from coded or labeled values.
When casting from coded or labeled values, it is strongly recommended that
the function castCheckForImport()
be used. This function permits the
user to state explicitly which values should be recognized as checked,
avoiding the ambiguity resulting from the coding.