Converts a numeric argument into a string that has been rounded to a
significant figure-like number. Scientific notation output
is avoided, however, and additional significant figures may be displayed for
large numbers. For example, if the number of significant digits
requested is 2, 123 will be displayed (rather than 120 or 1.2x10^2).

style_sigfig(x, digits = 2, big.mark = NULL, decimal.mark = NULL, ...)

## Arguments

x |
Numeric vector |

digits |
Integer specifying the minimum number of significant
digits to display |

big.mark |
Character used between every 3 digits to separate
hundreds/thousands/millions/etc.
Default is `","` , except when `decimal.mark = ","` when the default is a space. |

decimal.mark |
The character to be used to indicate the numeric decimal point.
Default is `"."` or `getOption("OutDec")` |

... |
Other arguments passed on to `base::format()` |

## Value

A character vector of styled numbers

## Details

If 2 sig figs are input, the number is rounded to 2 decimal places
when `abs(x) < 1`

, 1 decimal place when `abs(x) >= 1 & abs(x) < 10`

,
and to the nearest integer when `abs(x) >= 10`

.

## See also

## Author

Daniel D. Sjoberg

## Examples

#> [1] "0.12" "0.90" "1.1" "12" "-0.12" "-0.90" "-1.1" "-132" NA
#> [10] "0.00"