ec_util_dummy_mutualeclusive {echoice2} | R Documentation |
Find mutually exclusive columns
Description
This function finds pairs of columns in a data frame that are mutually exclusive, i.e., that never have positive values at the same time.
Usage
ec_util_dummy_mutualeclusive(data_in, filtered = TRUE)
Arguments
data_in |
A data frame containing the data. |
filtered |
A logical value indicating whether to return only the mutually exclusive pairs (TRUE) or all pairs (FALSE). Default is TRUE. |
Value
A tibble containing all pairs of mutually exclusive columns in the data frame.
Examples
minidata=structure(list(id = c("1", "1", "1", "1", "2", "2", "2", "2"),
task = c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L),
alt = c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L),
brand1 = c(1, 0, 1, 0, 1, 0, 1, 0),
brand2 = c(0, 1, 0, 1, 0, 1, 0, 1),
price = c(1, 2, 1, 2, 1, 2, 1, 2),
x = c(1, 0, 0, 1, 1, 0, 1, 0)),
class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -8L))
ec_util_dummy_mutualeclusive(minidata)
[Package echoice2 version 0.2.4 Index]