Compactly Show STRucture of Rmpfr Number Object

Share:

Description

The str method for objects of class mpfr produces a bit more useful output than the default method str.default.

Usage

1
2
3
4
## S3 method for class 'mpfr'
str(object, nest.lev, give.head=TRUE,
    digits.d = 12, vec.len = NULL, drop0trailing=TRUE,
    width = getOption("width"), ...)

Arguments

object

an object of class mpfr.

nest.lev

for str(), typically only used when called by a higher level str().

give.head

logical indicating if the “header” should be printed.

digits.d

the number of digits to be used, will be passed formatMpfr() and hence NULL will use “as many as needed”, i.e. often too many. If this is a number, as per default, less digits will be used in case the precision (getPrec(object)) is smaller.

vec.len

the number of elements that will be shown. The default depends on the precision of object and width (since Rmpfr 0.6-0, it was 3 previously).

drop0trailing

logical, passed to formatMpfr() (with a different default here).

width

the (approximately) desired width of output, see options(width = .).

...

further arguments, passed to formatMpfr().

See Also

mpfrIs0 for many more utilities.

Examples

1
2
3
4
5
6
7
8
(x <- c(Const("pi", 64), mpfr(-2:2, 64)))
str(x)
str(list(pi = pi, x.mpfr = x))
str(x ^ 1000)
str(x ^ -1e4, digits=NULL) # full precision

uu <- Const("pi", 16)# unaccurate
str(uu) # not using default of 12 digits

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.