Learn R Programming

rv (version 1.0)

Extract.rv: Extract or Replace Parts of a Random Vector

Description

Bracket slice and assignment methods adapted for random vectors and arrays.

Arguments

Value

  • A random variable (an rv object).

synopsis

## S3 method for class 'rv': [(x, \dots , drop = TRUE) ## S3 method for class 'rv': [<-(x, \dots , drop = TRUE) ## S3 method for class 'rv': [[<-(x, \dots , drop = TRUE)

Details

x may also be a regular vector that is automatically coerced into an rv object if the compatibility flag has been set to 1 by rvcompatibility(1) (this is the default). 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 (i, j, etc.) must be constants, but this may change in the future.

References

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").

See Also

See rvcompatibility for examples.

Examples

Run this code
#

Run the code above in your browser using DataLab