Subset the Combination Matrix

# S3 method for comb_mat
[(x, i, j, drop = FALSE)

Arguments

x

A combination matrix returned by make_comb_mat.

i

Indices on rows.

j

Indices on columns.

drop

It is always reset to FALSE internally.

Details

If sets are on rows of the combination matrix, the row indices correspond to sets and column indices correspond to combination sets, and if sets are on columns of the combination matrix, rows correspond to the combination sets.

If the index is one-dimension, e.g. x[i], the index always corresponds to the combination sets.

You should not subset by the sets. It will give you wrong combination set size. The subsetting on sets are only used internally.

This subsetting method is mainly for subsetting combination sets, i.e., users can first use comb_size to get the size of each combination set, and filter them by the size.

Examples

set.seed(123) lt = list(a = sample(letters, 10), b = sample(letters, 15), c = sample(letters, 20)) m = make_comb_mat(lt) m2 = m[, comb_size(m) >= 3] comb_size(m2)
#> 001 110 011 111 #> 8 4 6 4
m[comb_size(m) >= 3]
#> A combination matrix with 3 sets and 4 combinations. #> ranges of combination set size: c(4, 8). #> mode for the combination size: distinct. #> sets are on rows. #> #> Utility functions that can be applied: #> - set_name(): name of the sets. #> - set_size(): size of the sets. #> - comb_name(): name of the combination sets. #> - comb_size(): size of the combination sets. #> - comb_degree(): degree of the combination sets. #> - extract_comb(): extract elements in the specific combination set. #> - t(): transpose the combination matrix on the UpSet plot. #> - '[': subset the combination matrix.