bignum-format | R Documentation |
Customize how a biginteger
or bigfloat
vector is displayed.
The precision can be controlled with a number of significant figures, or with
a maximum or fixed number of digits after the decimal point. You can also
choose between decimal, scientific and hexadecimal notations.
The default formatting applied when printing depends on the type of object:
standalone vector: consults "bignum.sigfig"
and "bignum.max_dec_width"
tibble column: consults "pillar.sigfig"
and "pillar.max_dec_width"
## S3 method for class 'bignum_biginteger'
format(
x,
...,
sigfig = NULL,
digits = NULL,
notation = c("fit", "dec", "sci", "hex")
)
## S3 method for class 'bignum_bigfloat'
format(x, ..., sigfig = NULL, digits = NULL, notation = c("fit", "dec", "sci"))
x |
A |
... |
These dots are for future extensions and must be empty. |
sigfig |
Number of significant figures to show. Must be positive.
Cannot be combined with If both |
digits |
Number of digits to show after the decimal point.
Positive values indicate the exact number of digits to show.
Negative values indicate the maximum number of digits to show (terminal
zeros are hidden if there are no subsequent non-zero digits).
Cannot be combined with |
notation |
How should the vector be displayed? Choices:
|
Character vector
# default uses decimal notation
format(bigfloat(1e12))
# until it becomes too wide, then it uses scientific notation
format(bigfloat(1e13))
# hexadecimal notation is supported for positive integers
format(biginteger(255), notation = "hex")
# significant figures
format(bigfloat(12.5), sigfig = 2)
# fixed digits after decimal point
format(bigfloat(12.5), digits = 2)
# maximum digits after decimal point
format(bigfloat(12.5), digits = -2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.