Hi,
I'm looking for a dplyr code which utilizes data of the following structure
#> # A tibble: 5 × 5
#> ID value_A value_B value_C value_D
#> <chr> <lgl> <lgl> <lgl> <lgl>
#> 1 ID_1 TRUE FALSE TRUE FALSE
#> 2 ID_2 FALSE TRUE TRUE FALSE
#> 3 ID_3 FALSE FALSE TRUE FALSE
#> 4 ID_4 TRUE TRUE FALSE FALSE
#> 5 ID_5 FALSE FALSE FALSE TRUE
I would like to get combinations of the colums which yields highest 'TRUE ratio' (union). Let say I want a combination of twho colums which combined have the highest number of TRUE in each row. For instance, a combination of columns 'value_A' & 'value_B' have 'TRUE ratio' of 3.
I'd like to get ordered combinations of colums accoding to 'TRUE ratio' for x number of columns.
First, an ordered combinations of 2 columns.....
Second, an ordered combinations of 3 columns.....
and so on.
Any ideas? I will appreciate your thoughts.
Many thanks,
Jakub