Skip to contents

Get a distribution's representation as a function

Usage

representation_as_function(distribution, representation)

Arguments

distribution

Distribution to extract a representation from.

representation

Character, such as "cdf". In general, a suffix to an eval_ function.

Value

A function of the representation.

Examples

d <- dst_nbinom(10, 0.4)
cdf <- distionary:::representation_as_function(d, "cdf")
cdf(0:10)
#>  [1] 0.0001048576 0.0007340032 0.0028101837 0.0077930168 0.0175095415
#>  [6] 0.0338333029 0.0583189450 0.0918992542 0.1347141484 0.1860920214
#> [11] 0.2446627967