Skip to content

Adding new standard column structure functions - #431

Open
gmbecker wants to merge 35 commits into
devfrom
colstruct_subgrp_off_dev
Open

gmbecker wants to merge 35 commits into
devfrom
colstruct_subgrp_off_dev

Conversation

@gmbecker

@gmbecker gmbecker commented Aug 11, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

Fixes #432

Checks

  • (Have you updated the NEWS.md ?)
  • (Have you added proper tests for new functions/features ?)
  • (Have you added new functions to the pkgdown.yml ?)
  • (Have you run document() on new functions ?)

@munoztd0
munoztd0 marked this pull request as ready for review August 12, 2026 13:16
@munoztd0 munoztd0 changed the title add grouped_cols_w_subgrps Adding new standard column structure functions Aug 12, 2026
@munoztd0
munoztd0 force-pushed the colstruct_subgrp_off_dev branch from 4eb466d to 65ad827 Compare August 13, 2026 15:10
@munoztd0

Copy link
Copy Markdown
Collaborator

@gmbecker added quartile col str

dat <- create_colspan_var(
   data.frame(
     TRT01A = factor(rep(c("Placebo", "Active 1"), each = 20)),
     BW = c(rnorm(20, 70, 10), rnorm(20, 75, 10))
   ),
   non_active_grp = "Placebo",
   non_active_grp_span_lbl = "Control",
   active_grp_span_lbl = "Active Treatment",
   colspan_var = "colspan_trt",
   trt_var = "TRT01A"
 )
 colspan_trt_map <- create_colspan_map(
   dat,
   non_active_grp = "Placebo",
   non_active_grp_span_lbl = "Control",
   active_grp_span_lbl = "Active Treatment",
   colspan_var = "colspan_trt",
   trt_var = "TRT01A"
 )

 lyt <- basic_table() |>
   quartile_col_struct(
     var = "BW",
     colspan_trt_map = colspan_trt_map,
     span_lbl = "Body Weight (kg) Quartiles"
   ) |>
   analyze("BW", afun = function(x, ...) length(x))

 build_table(lyt, dat)


looks like :

 
                   Active Treatment                                    Control                   
                       Active 1                                        Placebo                   
                        (N=20)                                          (N=20)                   
              Body Weight (kg) Quartiles                      Body Weight (kg) Quartiles         
     58 to <68   68 to <76   76 to <80   80 to 102   47 to <62   62 to <69   69 to <74   74 to 95
—————————————————————————————————————————————————————————————————————————————————————————————————
BW       5           5           5           5           5           5           5          5    

@munoztd0
munoztd0 self-requested a review September 17, 2026 09:42
@munoztd0

Copy link
Copy Markdown
Collaborator

@gmbecker quartile col str now looks like these from @jkovach2 comments


dat <- data.frame(
  TRT01A = factor(rep(c("Placebo", "Active 1"), each = 10)),
  WGTGR1 = factor(
    rep(c("47 to <62", "62 to <69", "69 to <74", "74 to 95", "47 to <62"), 4),
    levels = c("47 to <62", "62 to <69", "69 to <74", "74 to 95")
  )
)
dat <- create_colspan_var(
  dat,
  non_active_grp = "Placebo",
  non_active_grp_span_lbl = "Control",
  active_grp_span_lbl = "Active Treatment",
  colspan_var = "colspan_trt",
  trt_var = "TRT01A"
)
colspan_trt_map <- create_colspan_map(
  dat,
  non_active_grp = "Placebo",
  non_active_grp_span_lbl = "Control",
  active_grp_span_lbl = "Active Treatment",
  colspan_var = "colspan_trt",
  trt_var = "TRT01A"
)

lyt <- basic_table() |>
  quartile_col_struct(
    grp_var = "WGTGR1",
    colspan_trt_map = colspan_trt_map,
    span_lbl = "Body Weight (kg) Quartiles"
  ) |>
  analyze("BW", afun = function(x, ...) length(x))

build_table(lyt, dat)


looks like :

           		 Active Treatment                                  Control                   
                           Active 1                                       Placebo                   
                            (N=10)                                         (N=10)                   
                  Body Weight (kg) Quartiles                     Body Weight (kg) Quartiles         
         47 to <62   62 to <69   69 to <74   74 to 95   47 to <62   62 to <69   69 to <74   74 to 95
————————————————————————————————————————————————————————————————————————————————————————————————————
BW       4           2           2          2           4           2           2          2     

@munoztd0
munoztd0 force-pushed the colstruct_subgrp_off_dev branch from 420a7da to 95578e0 Compare September 30, 2026 15:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants