cc: Combine values in an rv object

Description Usage Arguments Details Author(s) References Examples

View source: R/c_rv.R

Description

Concatentates random vectors.

Usage

1
2
3
4
cc(..., recursive = FALSE)

## S3 method for class 'rv'
c(..., recursive = FALSE)

Arguments

...

objects to be concatenated. Can be a mixture of constants and rv objects.

recursive

logical. If recursive = TRUE, the function recursively descends through lists (and pairlists) combining all their elements into a vector.

Details

NOTE: recursive has not yet been tested.

cc is a function that works for both non-rv and other vectors. To make code compatible for both constant vectors and rv objects, one can use cc instead of c.

Author(s)

Jouni Kerman jouni@kerman.com

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  x <- rvnorm(2)
  y <- rvbern(2, prob=0.5)
  z <- c(x, y)
  print(z)
  z1 <- cc(1, z)
  z2 <- c(as.rv(1), z)
  z3 <- c(as.rv(1), z)
  print(z1)
  print(z2)
  print(z3)

jsta/rv documentation built on Feb. 12, 2022, 5:13 p.m.