Learn R Programming

rv (version 0.949)

integer.rv: Integer-valued Random Vectors

Description

Tests or coerces (numeric or logical-valued) random vector objects into integer-valued ones.

Usage

## S3 method for class 'rv':
is.integer(x)
  ## S3 method for class 'rv':
as.integer(x, \dots)

Arguments

x
an rv object
...
other arguments

Details

is.integer(x) returns TRUE if and only if each component of x is integer-valued.

as.integer.rv coerces an rv object into integer-valued one. In effect, the function as.integer is applied to all simulations.

References

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

See Also

logical.rv

Examples

Run this code
x <- rvpois(lambda=1)   # some integer-valued random variable
  is.integer(x)           # FALSE, because by default x is 'double'!
  x <- as.integer(x)      # coerce to integer
  is.integer(x)           # TRUE

Run the code above in your browser using DataLab