Bracket slice and assignment methods adapted for random vectors and arrays.
The assignment function
impute<- is compatible with both non-rv and
rv objects (rv, rvsummary, and rvfactor objects). To write universal code
that works both atomic and rv objects, use
impute(x, ...) <- value
x[...] <- value.
x will NOT be automatically coerced into an rv object.
value may be an rv object or a regular numeric object.
Extracting rv objects works the same way as extracting components of a numerical vector or array. The return value is always an object of class 'rv'. Type ?Extract for details.
Note: the index arguments (
j, etc.) must be
constants, but this may change in the future.
random variables, however they will be coerced would expect.
object from which to extract element(s) or in which to replace element(s).
indices specifying elements to extract or replace.
typically an array-like R object of a similar class as
For matrices and arrays. If
A random variable (an rv object).
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
1 2 3 4 5 6 7
x <- rvnorm(1) y <- (1:5) ## Not run: y <- x ## Will not work ## End(Not run) impute(y, 2) <- x
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.