best_cutoff2: Extract best cut-off and add new binary object to data frame

View source: R/best_cutoff2.R

best_cutoff2R Documentation

Extract best cut-off and add new binary object to data frame

Description

The "best_cutoff" function is used to find the best cutoff point for a continuous variable in survival analysis. It takes input data ("pdata") containing a continuous variable ("variable") and survival information ("time" and "status"). It returns the modified input data with a new binary variable created based on the best cutoff point.

Usage

best_cutoff2(
  pdata,
  variable,
  time = "time",
  status = "status",
  PrintResult = T
)

Arguments

pdata

phenotype data with survival information and features

variable

The name of the continuous variable in the input data for which the best cutoff needs to be determined.

time

The name of the column in the input data representing the time-to-event (survival time). The default value is "time".

status

The name of the column in the input data representing the event status (censoring information). The default value is "status".

PrintResult

A logical value indicating whether to print the results. The default value is TRUE.

Value

pdata with binary variables and best cutoff

Author(s)

Dongqiang Zeng

Examples


# Loading TCGA-STAD microenvironment signature data
data("sig_stad", package = "IOBR")
# Finding the best cutoff value of TMEscore for survival
sig_stad2 <- best_cutoff2(pdata = sig_stad, variable = "TMEscore_CIR", time = "OS_time",status = "OS_status", PrintResult = T)
sig_stad2$best_cutoff


IOBR/IOBR documentation built on April 4, 2024, 1:07 a.m.