Skip to content

Commit

Permalink
Merge pull request #28 from halhen/improve_performance_with_large_data
Browse files Browse the repository at this point in the history
Improve performance of generating distinct interactions
  • Loading branch information
sgratzl authored Jul 7, 2022
2 parents 4b375a8 + 12f306f commit a515fbe
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions R/data-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,11 @@ generateCombinationsImpl <- function(sets,
otherSets <- Filter(function(ss) {
!(ss$name %in% s$setNames)
}, sets)
dElems <- Filter(function(e) {
for (o in otherSets) {
if (e %in% o$elems) {
return(FALSE)
}
}
TRUE
}, s$elems)

dElems <- s$elems
for (o in otherSets) {
dElems <- setdiff(dElems, o$elems)
}

if (s$cardinality == length(dElems)) {
combinations <<- c(combinations, list(s))
Expand Down

0 comments on commit a515fbe

Please sign in to comment.