% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/format_base_char_subgroup.R
\name{format_base_char_subgroup}
\alias{format_base_char_subgroup}
\title{Prepare data for Subgroup Analysis for Baseline Characteristic}
\usage{
format_base_char_subgroup(
  outdata,
  display = c("n", "prop", "total"),
  display_stat = c("mean", "sd", "median", "range"),
  display_total = TRUE
)
}
\arguments{
\item{outdata}{A metadata object created by \code{\link[=prepare_base_char_subgroup]{prepare_base_char_subgroup()}}.}

\item{display}{Column wants to display on the table.
The term could be selected from \code{c("n", "prop", "total")}.
"total" can display the total column for the first level header.}

\item{display_stat}{A vector of statistics term name.
The term name could be selected from
\code{c("mean", "sd", "se", "median", "q1 to q3", "range", "q1", "q3", "min", "max")}.}

\item{display_total}{A logic value of displaying the total column
for the second level header.}
}
\value{
A list of analysis raw datasets.
}
\description{
Prepare data for Subgroup Analysis for Baseline Characteristic
}
\examples{
meta <- metalite::meta_adam(
  population = metalite_sl_adsl,
  observation = metalite_sl_adsl
) |>
  metalite::define_plan(metalite::plan(
    analysis = "base_char_subgroup",
    population = "apat",
    observation = "apat",
    parameter = "age"
  )) |>
  metalite::define_population(
    name = "apat",
    group = "TRTA",
    subset = SAFFL == "Y"
  ) |>
  metalite::define_parameter(
    name = "age",
    var = "AGE",
    label = "Age (years)",
    vargroup = "AGEGR1"
  ) |>
  metalite::define_analysis(
    name = "base_char_subgroup",
    title = "Participant by Age Category and Sex"
  ) |>
  metalite::meta_build()

outdata <- prepare_base_char_subgroup(
  meta,
  population = "apat",
  parameter = "age",
  subgroup_var = "TRTA",
  subgroup_header = c("SEX", "TRTA")
)

outdata |> format_base_char_subgroup()
}
