Learn R Programming

algebraic.dist (version 0.9.1)

sampler.exponential: Method to sample from an exponential object.

Description

Method to sample from an exponential object.

Usage

# S3 method for exponential
sampler(x, ...)

Value

A function that allows sampling from the exponential distribution. Accepts an argument n denoting sample size and rate denoting the failure rate. Defaults to the failure rate of object x.

Arguments

x

The exponential object to sample from.

...

Additional arguments to pass (not used)

Examples

Run this code
x <- exponential(rate = 2)
s <- sampler(x)
set.seed(42)
s(5)

Run the code above in your browser using DataLab