Transpose a random array by permuting its dimensions and optionally resizing it.
# S3 method for rv
aperm(a, perm, ...)
the random matrix to be transposed
the subscript permutation vector. See the manual page for the gneric method aperm.
further arguments passed to aperm
This is the rv-compatible version of the function aperm
. It
first applies
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv")
.
x <- rvarray(rvnorm(24), dim=c(2,3,4))
print(aperm(x))
#> mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
#> [1,1,1] 0.02967 1.01 -2.3 -2.0 -0.67 0.0258 0.73 2.0 2.4 4000
#> [2,1,1] -0.02119 1.00 -2.3 -1.9 -0.71 -0.0263 0.64 2.0 2.4 4000
#> [3,1,1] 0.01338 1.01 -2.3 -1.9 -0.66 0.0125 0.68 2.0 2.4 4000
#> [4,1,1] 0.02752 1.00 -2.2 -1.9 -0.66 0.0106 0.71 2.0 2.4 4000
#> [1,2,1] -0.01783 0.99 -2.3 -1.9 -0.69 -0.0113 0.64 1.9 2.2 4000
#> [2,2,1] 0.00266 1.00 -2.3 -1.9 -0.69 0.0240 0.67 2.0 2.3 4000
#> [3,2,1] 0.00463 1.02 -2.4 -2.0 -0.67 0.0194 0.71 2.0 2.3 4000
#> [4,2,1] -0.00825 1.02 -2.4 -2.0 -0.67 -0.0245 0.66 2.0 2.5 4000
#> [1,3,1] -0.00583 1.01 -2.4 -2.0 -0.70 0.0247 0.68 1.9 2.2 4000
#> [2,3,1] -0.00065 1.00 -2.3 -2.0 -0.67 0.0159 0.68 2.0 2.4 4000
#> [3,3,1] -0.00290 0.99 -2.3 -1.9 -0.67 0.0036 0.65 1.9 2.2 4000
#> [4,3,1] -0.01747 0.98 -2.3 -2.0 -0.69 -0.0179 0.64 1.9 2.2 4000
#> [1,1,2] 0.00088 1.00 -2.4 -2.0 -0.69 0.0076 0.69 2.0 2.4 4000
#> [2,1,2] 0.00274 1.01 -2.3 -1.9 -0.70 0.0234 0.69 1.9 2.4 4000
#> [3,1,2] 0.00214 0.98 -2.4 -2.0 -0.64 0.0183 0.69 1.9 2.2 4000
#> [4,1,2] -0.02149 1.00 -2.3 -1.9 -0.70 -0.0011 0.66 1.9 2.3 4000
#> [1,2,2] -0.04093 0.99 -2.4 -2.0 -0.71 -0.0414 0.62 1.9 2.3 4000
#> [2,2,2] -0.02128 1.01 -2.3 -2.0 -0.72 -0.0226 0.66 2.0 2.3 4000
#> [3,2,2] -0.00444 1.00 -2.3 -1.9 -0.67 -0.0017 0.67 2.0 2.3 4000
#> [4,2,2] 0.01496 1.00 -2.4 -1.9 -0.66 0.0287 0.68 2.0 2.4 4000
#> [1,3,2] -0.00226 0.99 -2.3 -2.0 -0.65 0.0124 0.67 1.9 2.3 4000
#> [2,3,2] 0.03084 0.98 -2.3 -1.9 -0.62 0.0439 0.68 2.0 2.3 4000
#> [3,3,2] -0.00781 1.02 -2.3 -2.0 -0.68 -0.0115 0.67 2.0 2.5 4000
#> [4,3,2] -0.00508 1.02 -2.4 -2.0 -0.68 -0.0079 0.67 2.0 2.3 4000