Skip to content

Commit 1b8ee38

Browse files
committed
use combn directly to apply function
1 parent 746585a commit 1b8ee38

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

R/fortify-upset.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,14 @@ fortify_upset.list <- function(data, mode = "distinct", ...) {
8484
seq_len(vec_size(intersection)),
8585
function(n) {
8686
# generate all possible intersections
87-
index <- utils::combn(vec_size(intersection), n)
88-
lapply(seq_len(ncol(index)), function(i) {
89-
intersection[index[, i, drop = TRUE]] <- TRUE
87+
utils::combn(vec_size(intersection), n, function(index) {
88+
intersection[index] <- TRUE
9089
list(
9190
intersection = intersection,
9291
# for each intersection, we define the size
9392
size = vec_size(action(data, intersection))
9493
)
95-
})
94+
}, simplify = FALSE)
9695
}
9796
)
9897

0 commit comments

Comments
 (0)