% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/surv_group.R
\name{surv_group}
\alias{surv_group}
\title{Generate Kaplan-Meier Survival Plots for Categorical Groups}
\usage{
surv_group(
  input_pdata,
  target_group,
  ID = "ID",
  levels = c("High", "Low"),
  reference_group = NULL,
  project = NULL,
  time = "time",
  status = "status",
  time_type = "month",
  break_month = "auto",
  cols = NULL,
  palette = "jama",
  mini_sig = "score",
  save_path = NULL,
  fig.type = "pdf",
  index = 1,
  width = 6,
  height = 6.5,
  font.size.table = 3
)
}
\arguments{
\item{input_pdata}{Data frame containing survival data and grouping variables.}

\item{target_group}{Name of column containing the grouping variable.}

\item{ID}{Name of column with unique identifiers. Default is "ID".}

\item{levels}{Names for levels of target_group (for binary groups).
Default is c("High", "Low").}

\item{reference_group}{Reference level for binary comparison. Default is NULL.}

\item{project}{Optional title for plot. Default is NULL.}

\item{time}{Name of column with follow-up times. Default is "time".}

\item{status}{Name of column with event indicators. Default is "status".}

\item{time_type}{Units: "month" or "day". Default is "month".}

\item{break_month}{X-axis break interval. If "auto", calculated automatically.
Default is "auto".}

\item{cols}{Color vector for plot lines. Default is NULL.}

\item{palette}{Color palette name. Default is "jama".}

\item{mini_sig}{Prefix label for variables. Default is "score".}

\item{save_path}{Directory for saving plot. Default is NULL.}

\item{fig.type}{File format: "pdf" or "png". Default is "pdf".}

\item{index}{Identifier for file naming. Default is 1.}

\item{width}{Plot width. Default is 6.}

\item{height}{Plot height. Default is 6.5.}

\item{font.size.table}{Font size for risk table. Default is 3.}
}
\value{
Kaplan-Meier plot object.
}
\description{
Creates Kaplan-Meier survival plots for data grouped by a categorical variable.
Handles both binary and multi-level categorical groups with customizable plot
aesthetics.
}
\examples{
# Simulate data
set.seed(123)
sim_pdata <- data.frame(
  ID = paste0("Sample", 1:100),
  Lauren = sample(c("Intestinal", "Diffuse"), 100, replace = TRUE),
  time = runif(100, 1, 60),
  OS_status = sample(0:1, 100, replace = TRUE)
)
# Run survival analysis (survival and survminer are imported packages)
result <- surv_group(
  input_pdata = sim_pdata,
  target_group = "Lauren",
  time = "time",
  status = "OS_status",
  save_path = NULL
)
if (!is.null(result)) print(result)
}
\author{
Dongqiang Zeng
}
