Convert implements the `cut' function using random variables.

rvcut(x, ...)

Arguments

x

a plain or a random vector which is to be converted to a factor by cutting.

...

arguments passed to the function cut.

Value

A random factor.

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

Author

Jouni Kerman jouni@kerman.com

Examples


  rvcut(rvnorm(1), breaks=c(-Inf,-2,-1,0,1,2,Inf))
#>     (-Inf,-2] (-2,-1] (-1,0] (0,1] (1,2] (2, Inf] sims
#> [1]     0.025   0.135   0.36  0.32 0.125    0.035  200