% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/best_cutoff.R
\name{best_cutoff}
\alias{best_cutoff}
\title{Extract Best Cutoff and Add Binary Variable to Data Frame}
\usage{
best_cutoff(
  pdata,
  variable,
  time = "time",
  status = "status",
  print_result = TRUE
)
}
\arguments{
\item{pdata}{Data frame containing survival information and the continuous
variable.}

\item{variable}{Character string specifying the name of the continuous
variable for which the optimal cutoff should be determined.}

\item{time}{Character string specifying the column name containing
time-to-event data. Default is `"time"`.}

\item{status}{Character string specifying the column name containing event
status (censoring information). Default is `"status"`.}

\item{print_result}{Logical indicating whether to print detailed results
including cutoff value and Cox model summaries. Default is `TRUE`.}
}
\value{
Data frame identical to `pdata` with an additional binary column
  named `<variable>_binary` containing "High" and "Low" categories based on
  the optimal cutoff.
}
\description{
Determines the optimal cutoff point for a continuous variable in survival
analysis using the maximally selected rank statistics method. Creates a
binary variable based on the identified cutoff and adds it to the input data
frame.
}
\examples{
set.seed(123)
pdata <- data.frame(
  time = rexp(100),
  status = rbinom(100, 1, 0.5),
  score = rnorm(100, mean = 50, sd = 10)
)
result <- best_cutoff(pdata, variable = "score", print_result = FALSE)
table(result$score_binary)
}
\author{
Dongqiang Zeng
}
