Learn R Programming

rv (version 0.949)

unlist.rv: Flatten Lists Containing rv Objects

Description

Given a list structure x, unlist simplifies it to produce a vector which contains all the atomic components (containing rv objects) which occur in x.

Usage

## S3 method for class 'rv':
unlist(x, recursive = TRUE, use.names = TRUE)

Arguments

x
An R object, typically a list or vector (containing rv objects)
recursive
logical. Should unlisting be applied to list components of x?
use.names
logical. Should names be preserved? (now fixed to TRUE)

Details

This is the rv-compatible version of the function unlist.

Since unlist is not a generic function, the whole name unlist.rv must be specified when calling the function when x is an 'rv' object.

References

Kerman, Jouni and Gelman, Andrew. Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Technical report, Columbia University, New York.

See Also

unlist

Examples

Run this code
x <- list(a=rvnorm(2), b=rvnorm(3))
  print(unlist.rv(x))

Run the code above in your browser using DataLab