Fixed decimals, an optional leading zero, a thousands separator and the minus sign of the markup target. Every other formatter in apabayes builds on this one.
Arguments
- x
Numeric vector.
NA,NaN,Infand-Infare allowed.- digits
Single whole number of decimals to print (fixed, never significant digits).
- leading_zero
FALSEdrops the zero before the decimal point (.47,-.47), the APA rule for statistics that cannot exceed 1 in absolute value (correlations, standardized paths, proportions). Values of 1 or more keep their digits.- big_mark
TRUEseparates groups of three digits with a comma (1,240), the APA rule for numbers of 1,000 or more.- markup
NULLor one of"md","latex","typst","plain".NULLusesgetOption("apabayes.markup"), then the knitr output format, then"md". Decides the minus sign (U+2212 outside"plain") and the infinity symbol.
Details
Rounding is apabayes's own, so that the same value prints the same
string on every platform: the number is rounded as it is written, with
ties going away from zero (0.005 prints 0.01, 2.675 prints
2.68), and formatC() only lays the rounded number out. Leaving the
rounding to the C library made the result differ between Windows and
the other platforms. A result that would read -0.00 is printed
0.00.
papaja
papaja also exports a function called apa_num(). Whichever of the
two packages is attached last masks the other's. With both attached,
call apabayes::apa_num(). papaja's version prints a hyphen where
this one prints the minus sign.
