pharmaverse / pharmaverse/rtables
slightly relax label validity check
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 260
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Currently any use of "{" or "}" in a label is disallowed here:
This is due to formatters historically/currently being somewhat overly aggresive in guessing where referential footnotes are
I'd like to relax this to checking for the pattern " [{][^}]+[}]" (including the space)
This is due to formatting instructions being embedded in strings in the form, e.g., "~{super a}" for superscripted a in study metadata tracking tools. I didn't choose this, but I also can't change it, and with the leading ~ it is distinguishable from a referential footnote.
This will require a change to how refdefs are inferred in formatters to be safe, in particular, here:
Splitting that one gsub into two regexes, one grep to detect them which has the space and then the gsub to extract them, should be sufficient, e.g.,
refs <- matrix("", nrow = nrow(strs), ncol = ncol(strs))
haveref <- grepl(" [{][^}]*[}]", strs) ## with space
refs[haveref] <- gsub("^[^{]*([{]([^}]+)[}]){0,1}$", "\\2", strs[haveref]) ## without space, but only ones we know had one
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at R/00tabletrees.R line 23 in rtables to review the label validity check, then read formatters/R/matrix_form.R line 381 where refdefs are inferred. Verify that labels containing braces are accepted only when matching the stated space-prefixed pattern, while referential footnotes continue to be detected and extracted correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100