View source: R/utils_signifBeautify.R
signif_beautify | R Documentation |
Standard significant figure functions (such as signif
, format
) either do not output a string format (thereby excluding necessary trailing decimals & zeros), or do not correctly pad the number with the correct number of trailing zeros. This function aims to address these issues.
signif_beautify( n, sig_digits, justify_mode, decimal_mark = ".", big_mark = ",", big_interval = 3, pad_zeros = F, justify_char = " ", nsmall = NULL )
n |
Number or numeric vector to convert |
sig_digits |
Number of significant digits. If NA or NULL, the input number is not changed. |
justify_mode |
Mode to use for justifying a vector of values. Can be "l" (left), "c" (center), "r" (right), or "d" (decimal). |
decimal_mark |
Character to use as the decimal marker. |
big_mark |
If not blank, character to use in grouping every |
big_interval |
Number of digits between each |
pad_zeros |
Whether to add extra trailing zeros and/or a decimal to force number of significant digits (even if the original number did not have that many digits). Default = FALSE. |
justify_char |
Character (or string) used to pad strings. |
nsmall |
Forces output to have nsmall digits after the decimal. If there are fewer significant digits than total digits after including nsmall, the number of significant digits is increased. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.