This helper function conditionally formats a number with formatC()
function using "E"
format and specific number of digits as given by the
user. A number is formatted if and only if its absolute value is less than
0.001
or greater than 10000
. Otherwise, the number is not formatted.
Additionally, custom prefix or suffix can be appended to character string
with formatted number, so that the changes are marked.
Arguments
- x
(
number
)
a number to be formatted.- digits
(
function
)
the desired number of significant digits.- prefix
(
string
)
a prefix to be added in front of the formatted number.- suffix
(
string
)
a suffix to be appended after the formatted number.
Note
This function was primarily designed as a helper for
h_jags_write_model()
function.