# Basic usage
format_pvalue(0.0234)
#> "0.023"
format_pvalue(0.00005)
#> "< 0.001"
# Vector input
pvals <- c(0.5, 0.05, 0.001, 0.0001, NA)
format_pvalue(pvals)
#> "0.500" "0.050" "0.001" "< 0.001" NA
# Custom threshold
format_pvalue(0.005, threshold = 0.01)
#> "< 0.01"
# HTML output
format_pvalue(0.0001, html = TRUE)
#> "< 0.001"
Run the code above in your browser using DataLab