pharmaverse / pharmaverse/rtables

Proposal for a new `label_fun` argument for split functions

Open
#1,115 0 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

Hi @gmbecker ,

I’d like to propose adding a new argument (say, label_fun) to split_rows*() / split_cols*().

The idea would be to allow users to provide a function that changes/formats the levels of the split variable. For example, suppose we have a SEX variable in the dataset with levels MALE and FEMALE, but we want the split labels to appear as Male and Female instead.

With this argument, I could simply specify:

label_fun = junco::string_to_title

and that would be it. I think transformations like string_to_title() are very common when formatting labels, so this would be a convenient way to handle this without having to modify the dataset itself.

Please consider it. Thanks!

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

Locate the split_rows*() and split_cols*() entry points first, then trace how split-variable levels become displayed labels. The proposal is complete when a label_fun argument can format those labels, including MALE/FEMALE as Male/Female, without modifying the source dataset.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.