Skip to content

[Feature Request]: g_forest() to support point estimates and confidence intervals stored in a single column #1499

Description

@wwojciech

Feature description

Feature description

Currently, g_forest() requires the point estimate and confidence interval to be provided in separate columns:

  • the column indicated by col_x must contain a scalar value representing the point estimate;
  • the column indicated by col_ci must contain a pair of numbers representing the lower and upper confidence interval limits.

However, some tables store the point estimate and confidence interval limits together in a single column rather than in separate columns.

For example:

library(tern)

d <- formatters::ex_adlb
d$ABLFL_logical <- d$ABLFL == "Y"

results <- basic_table() |>
    split_cols_by("ARM", split_fun = keep_split_levels("A: Drug X")) |>
    split_rows_by("AVISIT", split_fun = keep_split_levels(c(
        "BASELINE",
        "WEEK 1 DAY 8",
        "WEEK 2 DAY 15"
    ))) |>
    summarize_change(
        "CHG",
        variables = list(value = "AVAL", baseline_flag = "ABLFL_logical"),
        .stats = "mean_ci_3d"
    ) |>
    build_table(d)

results
                        A: Drug X      
———————————————————————————————————————
BASELINE                               
  Mean (95% CI)   49.48 (48.66 - 50.31)
WEEK 1 DAY 8                           
  Mean (95% CI)    0.47 (-0.68 - 1.63) 
WEEK 2 DAY 15                          
  Mean (95% CI)    0.48 (-0.70 - 1.66) 

Requested enhancement

Extend g_forest() to support tables with a column containing all three values in the following format

est (ci_lwr, ci_upr).

(or some variation of this, that is: est (ci_lwr - ci_upr), est (ci_lwr; ci_upr), ....

g_forest() should be able to extract these three components internally and use them to generate the forest plot.

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions