pharmaverse / pharmaverse/rtables

`.path_to_pos()` fails when `path` contains regular expression symbols

Open
#1,058 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
260
Forks
53
PR merge metrics
No merged PRs in 30d

Description

The code at https://github.com/insightsengineering/rtables/blob/main/R/tt_pos_and_access.R#L995 can't match paths that contain regular expression symbols like +. For example:

pathregex <- "gear + carb"
pathstrs <- c("gear + carb`3 + 1", "gear + carb`3 + 2")
grep(pathregex, pathstrs)

# integer(0)

Adding fixed = TRUE to grep() seems a solution, but it would affect the function of character *.

See also https://github.com/johnsonandjohnson/junco/issues/100

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect R/tt_pos_and_access.R around line 995 and reproduce the example using grep() with the path containing '+'. Check how the matching logic treats regular-expression symbols and character ''. Done means paths containing '+' match correctly without breaking the existing '' behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.