% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sg-sim-tp.R
\name{sg_sim_tp}
\alias{sg_sim_tp}
\title{Time-profile plotting with optional summary bands}
\usage{
sg_sim_tp(
  ds_i,
  time_col = "TIME",
  val_col = "VALUE",
  group_i = "VAR",
  bands_i = NULL,
  cent_i = NULL,
  vrns_i = NULL,
  lperc_i = NULL,
  uperc_i = NULL,
  add_points = 0,
  col_i = NULL,
  fill_i = NULL,
  lty_i = NULL,
  shp_i = NULL,
  grid_i = NULL,
  wrap_i = NULL,
  free_stat = "free",
  wrap_ncol = NULL,
  wrap_nrow = NULL,
  min_x = NA,
  max_x = NA,
  min_y = NA,
  max_y = NA,
  log_y = FALSE,
  log_x = FALSE
)
}
\arguments{
\item{ds_i}{Data.frame. The data frame with source data.}

\item{time_col}{String. The column to use as a time column. Currently, can be only \code{TIME}. Default is \code{TIME}.}

\item{val_col}{String. Name of value column. Default is \code{VALUE}.}

\item{group_i}{String. Primary grouping variable for lines. Default is \code{'VAR'}.}

\item{bands_i}{vector of characters. Character vector of length 2 with column names for custom ymin/ymax ribbons. Default is \code{NULL}}

\item{cent_i}{string. Central tendency measure. One of \code{'mean'}, \code{'median'}, \code{'geom_mean'}, or \code{NULL} for raw values. Default is \code{NULL}}

\item{vrns_i}{string. Variance band type. One of \code{'SD'}, \code{'SE'}, \code{'IQR'}, or \code{NULL}. Default is \code{NULL}}

\item{lperc_i}{numeric. Lower percentile for percentile ribbons (must be provided together with \code{uperc_i}). Default is \code{NULL}}

\item{uperc_i}{numeric. Upper percentile for percentile ribbons (must be provided together with \code{lperc_i}). Default is \code{NULL}}

\item{add_points}{numeric. Size of points to add to the plot. If > 0, points will be added. Default is \code{0}}

\item{col_i}{String. Column name for color}

\item{fill_i}{String. Column name for fill aesthetic. Default is \code{NULL}}

\item{lty_i}{String. Column name for linetype aesthetic. Default is \code{NULL}.}

\item{shp_i}{String. Column name for shape aesthetic. Default is \code{NULL}.}

\item{grid_i}{string. Faceting formula for \code{facet_grid} (e.g., \code{'~VAR'} or \code{'A~B'}). Default is \code{NULL}}

\item{wrap_i}{String. Faceting formula for \code{facet_wrap}. Default is \code{NULL}.}

\item{free_stat}{String. Facet scaling option. One of \code{"free"}, \code{"free_x"},
\code{"free_y"}, or \code{"fixed"}. Default is \code{'free'}.}

\item{wrap_ncol}{Integer. Number of columns for \code{facet_wrap}. Default is \code{NULL}.}

\item{wrap_nrow}{Integer. Number of rows for \code{facet_wrap}. Default is \code{NULL}.}

\item{min_x}{Numeric. X-axis minimum limit. Default is \code{NA}.}

\item{max_x}{Numeric. X-axis maximum limit. Default is \code{NA}.}

\item{min_y}{Numeric. Y-axis minimum limit. Default is \code{NA}.}

\item{max_y}{Numeric. Y-axis maximum limit. Default is \code{NA}.}

\item{log_y}{Logical. If \code{TRUE}, a logarithmic scale is applied to y-axis. Default is \code{FALSE}.}

\item{log_x}{Logical. If \code{TRUE}, a logarithmic scale is applied to x-axis. Default is \code{FALSE}.}
}
\value{
A ggplot object with lines and optional ribbons/points/facets.
}
\description{
Creates a ggplot time-profile plot from longitudinal data with optional
summarization (mean/median/geometric mean), variance bands (SD/SE/IQR),
percentile ribbons, faceting, and log scaling.
}
\examples{
make_extended_mock_data <- function() {
 data.frame(
   TIME = rep(1:4, times = 6),
   VALUE = rnorm(24, mean = 10, sd = 2),
   VAR = rep(rep(c("A", "B"), each = 4), times = 3),
   Regimen = rep(c("R1", "R2", "R3"), each = 8),
   CAT1 = rep(c("Cat1", "Cat2"), each = 12)
 )
}
ds_sim <- make_extended_mock_data()
p <- sg_sim_tp(ds_i = ds_sim, group_i = 'VAR', col_i = 'VAR', fill_i = 'VAR',
               wrap_i = '~VAR', wrap_ncol = 2)
}
