formatC_mod: Modified formatC with Improved Zero and Exponential Handling
Description
Formats a numeric vector similar to formatC, but tweaks output for certain special cases:
- Attempts to remove trailing decimal points for whole numbers.
- If format is 'fg' and output is "0", falls back to fixed format (f).
- Converts exponential notation to plain numbers where appropriate.
Usage
formatC_mod(x, digits = NULL, format = NULL, ...)
Value
A character vector with formatted numbers.
Arguments
x
A numeric vector.
digits
Integer; desired number of digits.
format
Character string specifying the output format; see formatC. Common are "fg" (significant digits), or "f" (fixed).