% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/react_base_char.R
\name{react_base_char}
\alias{react_base_char}
\title{Display interactive baseline characteristic tables with AE subgroup analysis}
\usage{
react_base_char(
  metadata_sl,
  metadata_ae,
  population = "apat",
  observation = "wk12",
  display_total = TRUE,
  sl_parameter = "age;gender;race",
  ae_subgroup = c("gender", "race"),
  ae_specific = "rel",
  ae_analysis = "ae_specific",
  col_title = metalite::collect_title(metadata_ae, population, observation, ae_specific,
    ae_analysis, "analysis"),
  width = 1200
)
}
\arguments{
\item{metadata_sl}{A metadata created by metalite,
which builds the baseline characteristic table}

\item{metadata_ae}{A metadata created by metalite,
which builds the AE subgroup specific table}

\item{population}{A character value of population term name.
The term name is used as key to link information.}

\item{observation}{A character value of observation term name.
The term name is used as key to link information.}

\item{display_total}{Display total column or not.}

\item{sl_parameter}{A character value of parameter term name for
the baseline characteristic table.
The term name is used as key to link information.}

\item{ae_subgroup}{A vector of strubf to specify the subgroups
in the AE subgroup specific table.}

\item{ae_specific}{A string specifying the AE specific category.}

\item{ae_analysis}{A character value of analysis term name for
the AE specific table.}

\item{col_title}{A character value of column title for the AE specific table.}

\item{width}{A numeric value of width of the table in pixels.}
}
\value{
An reactable combing both baseline characteristic table
and AE subgroup specific tables.
}
\description{
Display interactive baseline characteristic tables with AE subgroup analysis
}
\examples{
if (interactive()) {
  sl_plan <- metalite::plan(
    analysis = "base_char",
    population = "apat",
    observation = "apat",
    parameter = "age;gender;race"
  )

  metadata_sl <- metalite::meta_adam(
    observation = metalite_sl_adsl,
    population = metalite_sl_adsl
  ) |>
    metalite::define_plan(sl_plan) |>
    metalite::define_population(
      name = "apat",
      group = "TRTA",
      subset = SAFFL == "Y"
    ) |>
    metalite::define_parameter(
      name = "age",
      var = "AGE",
      label = "Age (years)",
      vargroup = "AGEGR1"
    ) |>
    metalite::define_parameter(name = "gender", var = "SEX", label = "Gender") |>
    metalite::define_parameter(name = "race", var = "RACE", label = "Race") |>
    metalite::define_analysis(
      name = "base_char",
      title = "Participant Baseline Characteristics by Treatment Group"
    ) |>
    metalite::meta_build()

  analysis_plan <- metalite::plan(
    analysis = "ae_specific",
    population = "apat",
    observation = "wk12",
    parameter = "rel"
  )

  metadata_ae <- metalite::meta_adam(
    observation = metalite_sl_adae,
    population = metalite_sl_adsl
  ) |>
    metalite::define_plan(analysis_plan) |>
    metalite::define_population(
      name = "apat",
      group = "TRTA",
      subset = SAFFL == "Y",
      label = "All Participants as Treated"
    ) |>
    metalite::define_observation(
      name = "wk12",
      group = "TRTA",
      subset = SAFFL == "Y",
      label = "Weeks 0 to 12"
    ) |>
    metalite::define_parameter(
      name = "rel",
      term1 = "Drug-Related",
      term2 = "",
      subset = AEREL \%in\% c("POSSIBLE", "PROBABLE"),
      var = "AEDECOD",
      soc = "AEBODSYS",
      label = "Drug-related AEs"
    ) |>
    metalite::define_analysis(
      name = "ae_specific",
      title = "Participants With Drug-Related Adverse Events"
    ) |>
    metalite::meta_build()

  react_base_char(
    metadata_sl = metadata_sl,
    metadata_ae = metadata_ae,
    population = "apat",
    observation = "wk12",
    display_total = TRUE,
    sl_parameter = "age;gender;race",
    ae_subgroup = c("age", "race", "gender"),
    ae_specific = "rel",
    width = 1200
  )
}
}
