REDCapR::constant("form_incomplete") # Returns 0L
REDCapR::constant("form_unverified") # Returns 1L
REDCapR::constant("form_complete" ) # Returns 2L
REDCapR::constant("data_export_rights_no_access" ) # Returns 0L
REDCapR::constant("data_export_rights_deidentified") # Returns 1L
REDCapR::constant("data_export_rights_full" ) # Returns 2L
REDCapR::constant("form_rights_no_access") # Returns 0L
REDCapR::constant("form_rights_readonly" ) # Returns 2L --Notice the order
REDCapR::constant("form_rights_edit_form") # Returns 1L
REDCapR::constant("form_rights_edit_survey") # Returns 3L
REDCapR::constant("access_no" ) # Returns 0L
REDCapR::constant("access_yes") # Returns 1L
REDCapR::constant(c(
"form_complete",
"form_complete",
"form_incomplete"
)) # Returns c(2L, 2L, 0L)
REDCapR::constant(c(
"form_rights_no_access",
"form_rights_readonly",
"form_rights_edit_form",
"form_rights_edit_survey"
)) # Returns c(0L, 2L, 1L, 3L)
constant_to_form_completion( c(0, 2, 1, 2, NA))
constant_to_form_rights( c(0, 2, 1, 2, NA))
constant_to_export_rights( c(0, 2, 1, 3, NA))
constant_to_access( c(0, 1, 1, 0, NA))
if (FALSE) {
# The following line returns an error:
# Assertion on 'name' failed: Must be a subset of
# {'form_complete','form_incomplete','form_unverified'},
# but is {'bad-name'}.
REDCapR::constant("bad-name") # Returns an error
REDCapR::constant(c("form_complete", "bad-name")) # Returns an error
}
Run the code above in your browser using DataLab