formatN: Format Numbers Keeping Classes Distinguishable

Description Usage Arguments Value Author(s) See Also Examples

View source: R/biginteger.R

Description

Format (generalized) numbers in a way that their classes are distinguishable. Contrary to format() which uses a common format for all elements of x, here, each entry is formatted individually.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
formatN(x, ...)
## Default S3 method:
formatN(x, ...)
## S3 method for class 'integer'
formatN(x, ...)
## S3 method for class 'double'
formatN(x, ...)
## S3 method for class 'bigz'
formatN(x, ...)
## S3 method for class 'bigq'
formatN(x, ...)

Arguments

x

any R object, typically “number-like”.

...

potentially further arguments passed to methods.

Value

a character vector of the same length as x, each entry a representation of the corresponding entry in x.

Author(s)

Martin Maechler

See Also

format, including its (sophisticated) default method; as.character.

Examples

1
2
3
4
5
## Note that each class is uniquely recognizable from its output:
formatN(    -2:5)# integer
formatN(0 + -2:5)# double precision
formatN(as.bigz(-2:5))
formatN(as.bigq(-2:5, 4))


gmp documentation built on May 19, 2017, 3:32 p.m.
Search within the gmp package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.