Skip to contents

Creates a p-value label string with proper handling of inequality symbols. When the formatted p-value starts with "<" or ">", uses "p <value" or "p >value" format. Otherwise uses "p = value" format.

Usage

create_p_label(p.format, p.signif = NULL)

Arguments

p.format

Character string of the formatted p-value (e.g., "0.05", "< 0.001").

p.signif

Optional character string of significance symbol (e.g., "*", "**", "ns"). If provided, it will be appended after the p-value.

Value

A character string with the properly formatted p-value label. Missing values in p.format are preserved as NA_character_.

Examples

if (FALSE) { # \dontrun{
create_p_label("0.05")
# Returns: "p = 0.05"

create_p_label("< 0.001")
# Returns: "p < 0.001"

create_p_label("0.01", "**")
# Returns: "p = 0.01 **"

create_p_label("< 0.001", "****")
# Returns: "p < 0.001 ****"

create_p_label(c("0.05", NA_character_))
# Returns: c("p = 0.05", NA)
} # }