Description Usage Arguments Value Examples
View source: R/binary_patterns_var.R
This is useful when you have a collection of yes/no variables representing multiple choices in which more than one option can be selected.
1 2 3 4 5 6 7 | binary_patterns_var(
data,
strip_prefix = "",
mid_sep = ", ",
last_sep = " & ",
none_label = "(None)"
)
|
data |
Data frame or tibble containing the binary vectors |
strip_prefix |
A common prefix to remove from the start of the variable names |
mid_sep |
Character to separate names, by default a comma |
last_sep |
The last separator to use, by default an ampersand |
none_label |
How to represent the empty combination |
A character vector representing combinations of inputs
1 2 3 4 5 | test1 <- expand.grid(myvar_1 = c(0,1),
myvar_2 = c(0,1),
myvar_3 = c(0,1))
test1$pat <- binary_patterns_var(test1, "myvar_")
test1
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.