...
|
...
|
@@ -420,7 +420,7 @@ make_comb_mat = function(..., mode = c("distinct", "intersect", "union"),
|
420
|
420
|
mode = match.arg(mode)[1]
|
421
|
421
|
if(length(lt) == 1) {
|
422
|
422
|
lt = lt[[1]]
|
423
|
|
- if(!is.null(dim(lt))) {
|
|
423
|
+ if(length(dim(lt)) == 2) { # a matrix
|
424
|
424
|
m = make_comb_mat_from_matrix(lt, mode = mode, top_n_sets = top_n_sets,
|
425
|
425
|
min_set_size = min_set_size, universal_set = universal_set, complement_size = complement_size)
|
426
|
426
|
if(remove_empty_comb_set) {
|
...
|
...
|
@@ -512,6 +512,7 @@ set_size = function(m) {
|
512
|
512
|
#
|
513
|
513
|
# == param
|
514
|
514
|
# -m A combination matrix returned by `make_comb_mat`.
|
|
515
|
+# -degree degree of the intersection. The value can be a vector.
|
515
|
516
|
#
|
516
|
517
|
# == value
|
517
|
518
|
# A vector of sizes of the combination sets.
|
...
|
...
|
@@ -523,8 +524,13 @@ set_size = function(m) {
|
523
|
524
|
# c = sample(letters, 20))
|
524
|
525
|
# m = make_comb_mat(lt)
|
525
|
526
|
# comb_size(m)
|
526
|
|
-comb_size = function(m) {
|
527
|
|
- structure(attr(m, "comb_size"), names = comb_name(m))
|
|
527
|
+comb_size = function(m, degree = NULL) {
|
|
528
|
+ x = structure(attr(m, "comb_size"), names = comb_name(m))
|
|
529
|
+ if(is.null(degree)) {
|
|
530
|
+ return(x)
|
|
531
|
+ } else {
|
|
532
|
+ x[comb_degree(m) %in% degree]
|
|
533
|
+ }
|
528
|
534
|
}
|
529
|
535
|
|
530
|
536
|
# == title
|