Skip to content

Commit

Permalink
Merge pull request #110 from krassowski/fix-108-set-name-encoding
Browse files Browse the repository at this point in the history
Fix incorrect labels when using encode_sets=TRUE
  • Loading branch information
krassowski authored Apr 3, 2021
2 parents e843a8c + 113f7a5 commit 4312351
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 7 deletions.
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Version 1.2.0

Unreleased
2021-04-03

Bux fixes:
- [critical] fixed display order of labels when using `encode_sets=TRUE` #110
- encoding of set names will now properly work around name conflicts #110

Major improvements:
- manually specified intersections will now display empty intersections and non-exclusive intersections correctly #109
Expand Down
6 changes: 3 additions & 3 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ sanitize_names = function(variables_names) {

encode_names = function(variables_names, avoid) {
sapply(
# using order ensures that alphabetic order is retained in case of equal degrees
# using rank ensures that alphabetic order is retained in case of equal degrees
# and that re-ordering columns in the dataframe will not lead to flickering of the result
as.character(order(variables_names)),
as.character(rank(variables_names)),
function (name) {
while (any(name %in% avoid)) {
name = name + 'x'
name = paste0(name, 'x')
}
name
}
Expand Down
Loading

0 comments on commit 4312351

Please sign in to comment.