Skip to content

Commit

Permalink
use combn directly to apply function
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jan 5, 2025
1 parent 746585a commit 1b8ee38
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions R/fortify-upset.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ fortify_upset.list <- function(data, mode = "distinct", ...) {
seq_len(vec_size(intersection)),
function(n) {
# generate all possible intersections
index <- utils::combn(vec_size(intersection), n)
lapply(seq_len(ncol(index)), function(i) {
intersection[index[, i, drop = TRUE]] <- TRUE
utils::combn(vec_size(intersection), n, function(index) {
intersection[index] <- TRUE
list(
intersection = intersection,
# for each intersection, we define the size
size = vec_size(action(data, intersection))
)
})
}, simplify = FALSE)
}
)

Expand Down

0 comments on commit 1b8ee38

Please sign in to comment.