Edits to CreateCategoryMatrix for colon groups#10399
Open
mccormickceci wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes loss of : characters in aggregated group names by adjusting how CreateCategoryMatrix() post-processes column names when only a single grouping variable is used (the : is currently overloaded as an interaction separator).
Changes:
- Preserve
:characters in group labels whenCreateCategoryMatrix()is called with a single grouping column. - Minor whitespace cleanup in a warning call formatting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
3109
to
+3112
| FUN = function(name) { | ||
| name <- gsub(pattern = "data\\[, [1-9]*\\]", replacement = "", x = name) | ||
| if (length(group.by) == 1) { | ||
| return(name) |
Comment on lines
+3111
to
3115
| if (length(group.by) == 1) { | ||
| return(name) | ||
| } | ||
| return(paste0(rev(x = unlist(x = strsplit(x = name, split = ":"))), collapse = "_")) | ||
| })) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of change
Motivation
In the case that users were aggregating on a metadata variable containing a colon the colon would not be preserved in the result because we use colons inside of the CreateCategoryMatrix to split by groups.
Tests & examples
Related issues
This should fix the issue as it relates to #9137
Closes #9137
Checklist
feat/*,fix/*,docs/*)devtools::document()has been rundevtools::check()passes with no errors or warnings