lpvalue2: Format p-values for plot annotations

View source: R/helper.R

lpvalue2R Documentation

Format p-values for plot annotations

Description

Formats p-values specifically for display in plots (e.g., survival curves). Returns formatted string with "p = " or "p < " prefix.

Usage

lpvalue2(x, digits)

Arguments

x

Numeric p-value

digits

Number of decimal places to display (default from context)

Details

Formatting rules:

  • p < 10^-digits: returns "p < threshold" (e.g., "p < 0.001")

  • p >= threshold: returns "p = value" rounded to specified digits

Used by: ggkmcif2() for survival curve annotations in main.R and ggkmcif3.R

Value

Character string with "p = " or "p < " prefix

Examples

## Not run: 
lpvalue2(0.0001, 3)  # Returns: "p < 0.001"
lpvalue2(0.0456, 3)  # Returns: "p = 0.046"

## End(Not run)

reportRmd documentation built on March 20, 2026, 5:06 p.m.