Remove `display_soc_toggle =...` and `display_diff_toggle=...` in `ae_forestly()`?

クローズ
#185 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

@yihui がすでに取り組んでいます。

2026年11月4日 から。

  • #186 @yihui による — マージ済み

評価

この issue はまだ評価されていません。

説明

Motivated example

Observation: columns of count (i.e., the 'n" column) and the percentages columns (i.e., the "%" column) are displayed before the "AE proportion (%)" and "risk difference (%) + 95% CI vs. Low Dose"

Image

Expection: the "n" and "%" columns should be displayed at the end of the table

library(metalite)
library(forestly)

adsl <- forestly_adsl
adae <- forestly_adae

adsl$TRTA <- factor(forestly_adsl$TRT01A,
  levels = c("Xanomeline Low Dose", "Placebo"),
  labels = c("Low Dose", "Placebo")
)
adae$TRTA <- factor(forestly_adae$TRTA,
  levels = c("Xanomeline Low Dose", "Placebo"),
  labels = c("Low Dose", "Placebo")
)

meta <- meta_adam(population = adsl, observation = adae) |>
  define_plan(plan = plan(
    analysis = "ae_forestly",
    population = "apat",
    observation = "apat",
    parameter = "any;drug-related"
  )) |>
  define_analysis(name = "ae_forestly", label = "Interactive Forest Plot") |>
  define_population(
    name = "apat", group = "TRTA", id = "USUBJID",
    subset = SAFFL == "Y", label = "All Patient as Treated"
  ) |>
  define_observation(
    name = "apat", group = "TRTA",
    subset = SAFFL == "Y", label = "All Patient as Treated"
  ) |>
  define_parameter(
    name = "any",
    subset = NULL,
    label = "Any AEs",
    var = "AEDECOD", soc = "AEBODSYS"
  ) |>
  define_parameter(
    name = "drug-related",
    subset = toupper(AREL) == "RELATED",
    label = "Drug-related AEs",
    var = "AEDECOD", soc = "AEBODSYS"
  ) |>
  meta_build()

# Analysis Execution## Generate Interactive Forest Plot
meta |>  
  prepare_ae_forestly(components = "soc",    
                      population = "apat",    
                      observation = "apat",    
                      reference_group = 1,
                     parameter = "any;drug-related"  ) |>  
  format_ae_forestly(display = c("fig_prop", "fig_diff", "n", "prop" )) |>  
  ae_forestly(display_soc_toggle = FALSE,
              display_diff_toggle = TRUE,
              filter = c("prop", "n"),
              filter_range = c(0,20),
              width = 1400)

Root cause investigated by GPT6.1 Sol

This is a column-ordering bug in the installed packages, triggered by display_soc_toggle = FALSE.

Here’s what happens:

  1. forestly creates the numeric n and % columns, then adds the two plots.
  2. It tries to move the plots before the numeric columns using:
lt::lt_move(x, c("prop_fig", "diff_fig"), after = "soc_name")
  1. But display_soc_toggle = FALSE hides soc_name. The lt renderer removes hidden columns before applying the move. With the anchor missing, it silently skips the move.
    Consequently, n and % stay before the plots. I reproduced this behavior using your installed forestly 0.1.7 and lt 0.4.49.

The order of entries in display = c("fig_prop", "fig_diff", "n", "prop") does not control the column order. The robust package fix is to anchor the move after the always-visible "name" column instead of "soc_name".

Question

As we have "Show/Hide Columns", shall we still keep the arguments of display_soc_toggle =... and display_diff_toggle=... in ae_forestly()?

主要言語
R
スター
22
フォーク
6
平均マージ
1日 17時間
マージ済み PR(30日)
7

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Merck/forestly のほかの issue

Merck/forestly の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。