rv (version 2.3.4)

as.integer.rv: Integer Random vectors

Description

Coerces a random variable to an integer-valued (discrete) one

Usage

# S3 method for rv
as.integer(x, ...)

Arguments

x

an rv object

Further arguments passed on

Details

In effect, the function as.integer is applied to all simulations.

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

as.logical.rv.

Examples

Run this code
# NOT RUN {
  x <- rvpois(lambda=3)   # some integer-valued random variable
  print(x)
  is.integer(x)           # FALSE, because by default x is 'double'!
  x <- as.integer(x)      # coerce to integer
  is.integer(x)           # TRUE
  print(x)                # Shows also the 'min' and 'max' columns

# }

Run the code above in your browser using DataLab