camr_combine_redcap_checkboxes | R Documentation |
Use this function within dplyr::mutate
.
camr_combine_redcap_checkboxes(
cols,
fn_rename = function(x) str_remove(x, "^.*___"),
fn_predicate = function(x) {
if (!all(x %in% 0:1))
stop("Specified columns are not all 0 or 1.")
x == "1"
},
collapse = "|",
as.factor = FALSE
)
cols |
Tidyselect expression. |
fn_rename |
Function with which to rename collapsed columns. Default removes the '___' prefix. |
fn_predicate |
Function which transforms each checkbox field value to TRUE/FALSE. Default is x == 1. |
collapse |
Character to separate collapsed values. Defaut is '|'. |
as.factor |
Create a factor where the levels are all the possible combinations of values. Default is FALSE. |
Character or factor vector of collapsed checkbox values.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.