fix: Slope selector (HL-plots) not appearing with error Error in mutate: Can't transform a data frame with NA or "" names due to underscore ("_" ) in STUDYID - #1401
Merged
Gero1999 merged 7 commits intoJul 30, 2026
Conversation
parse_plot_names_to_df split plot names on every underscore, so grouping values containing underscores (e.g. STUDYID = "same_or_similar") were broken into fragments without a key. Those fragments became NA/"" column names and misaligned rows under rbind, crashing the Slope Selector with "Can't transform a data frame with NA or '' names".
Error in mutate: Can't transform a data frame with NA or "" names due to underscore ("_" ) in STUDYID
Error in mutate: Can't transform a data frame with NA or "" names due to underscore ("_" ) in STUDYIDError in mutate: Can't transform a data frame with NA or "" names due to underscore ("_" ) in STUDYID
Added details about the Slope Selector plots fix, addressing rendering errors related to grouping values with underscores.
Shaakon35
approved these changes
Jul 29, 2026
KOBANAK
approved these changes
Jul 30, 2026
KOBANAK
left a comment
Collaborator
There was a problem hiding this comment.
I tested with another dataset with "_" in STUDYID and it works as expected.
We no longer see the previous error in the slope selector section.
Gero1999
deleted the
1387-bug/hl_plots-with-underscored-strings-in-key-variables
branch
July 30, 2026 12:46
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.

Issue
Closes #1378
Description
The Slope Selector crashed with
Error in mutate: Can't transform a data frame with NA or "" nameswhenever a grouping value contained an underscore (e.g.STUDYID = "same_or_similar",PARAM = "Drug A").Root cause: half-life plots are keyed by names of the form
key1=val1_key2=val2_...(built inget_halflife_plots()).parse_plot_names_to_df()reversed this by splitting on every underscore, so underscores inside a value were treated as segment separators. This produced fragments with nokey=, which becameNA/""column names and misaligned rows underrbind(), abortingarrange_plots_by_groups()(and therefore the plot rendering) in the NCA > Slope Selector tab.Fix: split names only at real
key=boundaries (_(?=[A-Za-z.][A-Za-z0-9.]*=), PCRE) and combine rows withbind_rows()so columns align by name. Values may now safely contain underscores or spaces. Malformed segments are dropped rather than turned into empty column names, so the crash is structurally impossible.Definition of Done
STUDYID/PARAM/other grouping values contain underscores.parse_plot_names_to_df()never returnsNA/""column names.How to test
devtools::load_all()thenaNCA::run_app().STUDYID = "same_or_similar"), map it, and open NCA -> Setup -> Slope Selector.For the dataset you can use this one:
Can't transform a data frame with NA or "" names).Covered by unit tests in
tests/testthat/test-utils-slope_selector.R:Contributor checklist
.scsschange was done, rundata-raw/compile_css.Rdata-raw/test_suggests_hidden.RNotes to reviewer
### Slope Selectorbug-fix subsection: "Slope Selector no longer crashes withCan't transform a data frame with NA or '' nameswhen a grouping value (e.g.STUDYID,PARAM) contains an underscore. Plot names are now parsed atkey=boundaries instead of splitting on every underscore (Bug(s): 1) pak installation issue, 2) Half life plots not appearing in Slope Selector when dataset key variables contain "_" (can't transform a dataset with NA or "" in names) #1378)."devtools::test()andlintr::lint_package()were not run here. The split regex was validated against the failing inputs using the same PCRE engine (bothsame_or_similaranddivergentparse to identical key sets, sobind_rowsaligns cleanly). All changed lines are <=100 chars. Please run tests + lint before merging.0.1.0.9184->0.1.0.9185.customdata, not the parsed name string.