as.vector.rv coerces a given rv object into a vector; matrices
lose their dimension attributes, but rv objects stay as rv
objects (since they are considered to be "vectors").
# S3 method for rv
as.vector(x, mode = "any")an object
(currently not used)
as.vector.rv removes the dimension attribute and returns the rv
object. Needed for compatibility with code that uses as.vector.
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 <- rvmatrix(rvnorm(10), 2, 5)
as.vector(x)
#> mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
#> [1] -0.0177 0.99 -2.4 -1.9 -0.68 -0.0306 0.67 1.9 2.3 4000
#> [2] -0.0287 0.99 -2.4 -2.0 -0.66 -0.0542 0.63 2.0 2.3 4000
#> [3] -0.0135 0.98 -2.4 -2.0 -0.66 -0.0258 0.67 1.9 2.1 4000
#> [4] 0.0115 1.01 -2.3 -2.0 -0.66 0.0050 0.67 2.0 2.5 4000
#> [5] -0.0196 1.00 -2.4 -2.0 -0.71 -0.0052 0.65 1.9 2.2 4000
#> [6] 0.0195 1.01 -2.4 -1.9 -0.66 0.0138 0.70 2.0 2.3 4000
#> [7] 0.0189 1.01 -2.2 -1.9 -0.68 0.0187 0.70 2.0 2.4 4000
#> [8] -0.0076 1.02 -2.3 -2.0 -0.71 -0.0177 0.67 2.0 2.4 4000
#> [9] -0.0149 1.00 -2.4 -2.0 -0.66 0.0020 0.66 1.9 2.2 4000
#> [10] 0.0045 0.99 -2.2 -1.9 -0.66 0.0168 0.65 1.9 2.3 4000