signif_trailing() converts numeric values to character strings to
preserve trailing zeroes
signif_whole() rounds numeric values to a specified number of significant
figures, or the nearest whole value if the number of digits of x are
greater than digits.
signif_pvalue() displays p-values as either formatted numeric strings
or significance symbols.
Arguments
- x
A numeric vector.
- digits
An integer specifying the number of decimal places or significant figures to preserve. Negative
digitsvalues will round to the nearest whole value of10^(digits).- format
Indicates how to treat
digits. Either the desired number of decimal places (format = "digits", the default) or significant figures after the decimal place (format = "signif").- display
Specifies output type, either "value" (the default) for formatted numbers or "symbol" for significance symbols.
- symbol
Character string specifying the significance symbol. Default is "*".
- symbol_repeat
Logical indicating whether to repeat symbols for different significance levels. Default is FALSE.
- alpha
A numeric value specifying significance threshold. Default is
0.05.
Value
signif_trailing() returns a character vector of formatted numbers
the same length as x.
signif_whole() returns a numeric vector the same length as x.
signif_pvalue() returns a character vector of formatted p-values
or significance symbols the same length as x.
Details
signif_trailing()
Negative
digitsround to the respective integer place, e.g.signif_trailing(123, digits = -1)returns"120".
Decimal rounding is based on the "banker's rounding" default behaviour of
signif() and round(), where signif(123.45, 4) or round(123.45, 1)
each return 123.4.
signif_whole()
Negative
digitsround to the nearest whole value as ifdigits = 0, e.g.signif_whole(123, digits = -5)still returns123.
signif_pvalue()
When
display = "value"and e.g.digits = 3,xwill be either rounded to 3 decimal places withsignif_trailing(), or appear as e.g. "< 0.001".digits = 1will display "less thanalpha", e.g. "< 0.05".When
display = "symbol", ifsymbol_repeat = TRUE: Uses repeated symbols based on thresholds(0.001 = "***", 0.01 = "**", alpha = "*", ns = "").If
symbol_repeat = FALSE: Shows one symbol"*"for p < alpha, otherwise empty string.