Description Usage Arguments Value See Also Examples

Utility to construct an **R** object of class
`mpfrArray`

, very analogously to the numeric
`array`

function.

1 2 |

`x` |
numeric(like) vector, typically of length |

`precBits` |
a number, the maximal precision to be used, in
`53` corresponds to double precision.
Must be at least 2. |

`dim` |
the dimension of the array to be created, that is a vector of length one or more giving the maximal indices in each dimension. |

`dimnames` |
either |

`rnd.mode` |
a 1-letter string specifying how |

an object of class `"mpfrArray"`

, specifically
`"mpfrMatrix"`

when `length(dim) == 2`

.

`mpfr`

, `array`

;
`asNumeric()`

as “inverse” of `mpfrArray()`

,
to get back a numeric array.

`mpfr2array(x)`

is for `"mpfr"`

classed `x`

,
only, whereas `mpfrArray(x)`

is for numeric (“non-mpfr”)
`x`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
## preallocating is possible here too
ma <- mpfrArray(NA, prec = 80, dim = 2:4)
validObject(A2 <- mpfrArray(1:24, prec = 64, dim = 2:4))
## recycles, gives an "mpfrMatrix" and dimnames :
mat <- mpfrArray(1:5, 64, dim = c(5,3), dimnames=list(NULL, letters[1:3]))
mat
asNumeric(mat)
stopifnot(identical(asNumeric(mat),
matrix(1:5 +0, 5,3, dimnames=dimnames(mat))))
## Testing the apply() method :
apply(mat, 2, range)
apply(A2, 1:2, range)
apply(A2, 2:3, max)
(fA2 <- apply(A2, 2, fivenum))
a2 <- as(A2, "array")
stopifnot(as(apply(A2, 2, range), "matrix") ==
apply(a2, 2, range)
, all.equal(fA2, apply(a2, 2, fivenum))
, all.equal(apply(A2, 2, quantile),
apply(a2, 2, quantile))
, all.equal(A2, apply(A2, 2:3, identity) -> aA2, check.attributes=FALSE)
, dim(A2) == dim(aA2)
)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.