as.integer.rv: Integer Random vectors

as.integer.rvR Documentation

Integer Random vectors

Description

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

Usage

## S3 method for class '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.

Note

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

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

See Also

as.logical.rv.

Examples


  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


rv documentation built on March 18, 2022, 5:55 p.m.