Make full Venn combination data.frame

make_venn_combn_df(x, include_zero = FALSE, sep = "&", ...)

Arguments

x

either character vector of set names, or integer number of sets.

include_zero

logical indicating whether to include one row with all zeros, in the event of counting factors where some factor levels may not be present in any sets.

sep

character separator used when combining set names into a single label.

...

additional arguments are ignored.

Value

data.frame where rownames indicate each possible Venn overlap, colnames indicate each set name, and values are 0 or 1 indicating whether each set should have a value in each row.

Details

This function returns a data.frame with all possible combinations of set overlaps for the number of sets provided.

Examples

make_venn_combn_df(3);
#>                   set_1 set_2 set_3
#> set_1                 1     0     0
#> set_2                 0     1     0
#> set_3                 0     0     1
#> set_1&set_2           1     1     0
#> set_1&set_3           1     0     1
#> set_2&set_3           0     1     1
#> set_1&set_2&set_3     1     1     1
make_venn_combn_df(3, include_zero=TRUE);
#>                   set_1 set_2 set_3
#> none                  0     0     0
#> set_1                 1     0     0
#> set_2                 0     1     0
#> set_3                 0     0     1
#> set_1&set_2           1     1     0
#> set_1&set_3           1     0     1
#> set_2&set_3           0     1     1
#> set_1&set_2&set_3     1     1     1

make_venn_combn_df(letters[1:3]);
#>       a b c
#> a     1 0 0
#> b     0 1 0
#> c     0 0 1
#> a&b   1 1 0
#> a&c   1 0 1
#> b&c   0 1 1
#> a&b&c 1 1 1