Generic function for drawing random samples from distribution objects.
random(x, n = 1L, drop = TRUE, ...) ## S3 method for class 'distribution' simulate(object, nsim = 1L, seed = NULL, ...)
An object. The package provides methods for distribution
objects such as those from
The number of samples to draw. Should be a positive
integer. Defaults to
logical. Should the result be simplified to a vector if possible?
Arguments passed to methods. Unevaluated arguments will generate a warning to catch mispellings or other possible errors.
An optional random seed that is to be set using
random is a new generic for drawing random samples from
distribution objects provided in this package, such as
Binomial etc. The respective
methods typically call the "r" function for the corresponding
distribution functions provided in base R such as
In addition to the new
random generic there is also a
simulate method for distribution objects which simply
random method internally.
Random samples drawn from the distriubtion
## distribution object X <- Normal() ## 10 random samples random(X, 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.