build_cuts: Build cutpoint variables

View source: R/build_cuts.R

build_cutsR Documentation

Build cutpoint variables

Description

Transforms an ordinal variable into anywhere from two to five groups for cutpoint analysis.

Usage

build_cuts(x, n = c("b", "t", "qd", "qn"), var.prefix = NULL, list = FALSE)

Arguments

x

vector to split by certain cutpoints

n

either "b" for binarization (2 groups), "t" for trinarization (3 groups), "q" for quads (4 groups), or "qn" for quints (5 groups)

var.prefix

variable name prefix

list

if TRUE, the variables are returned as a list.

Value

By default, a tibble of cutpoint variables built from a categorical biomarker. The number of columns correspond to all the ways the biomarker could be cut into n bins. Each column name starts with a "b", "t", "qd", or "qn" for "binarization", "trinarization", "quads", or "quints", respectively, with the levels being compared separated by "v". If list = FALSE, each cutpoint variable is an element of a list.

Author(s)

Derek Chiu

Examples

set.seed(1108)
x <- sample(0:4, size = 1000, replace = TRUE)
build_cuts(x, n = "b")
build_cuts(x, n = "t")
build_cuts(x, n = "t", var.prefix = "PHGDH")
str(build_cuts(x, n = "qd", list = TRUE))

TalhoukLab/biostatUtil documentation built on April 14, 2025, 4:15 a.m.