This function takes a numeric value and rounds it, then it formats it in order to be reported in an academic report written in LaTeX or markdown. It is most useful for R output that is more than three decimal places long.

print_pval(x, latex = TRUE)

Arguments

x

(numeric) A p-value to round

latex

(Logical) If true, output is appropriate for LaTeX. Otherwise formatting is for markdown.

Examples

print_pval(0.03765)
#> [1] "\\emph{p} = .038"
print_pval(0.0000001, latex = FALSE)
#> [1] "*p* < .001"