Skip to contents

This function does the same thing as kwb.utils::distribution_repeater(), but it is bundled with ambre to avoid a hard dependency on the unmaintained package.

Usage

distribution_repeater(
  number_of_repeatings = 10,
  number_of_events = 365,
  func,
  ...
)

Arguments

number_of_repeatings

how often should the random distribution with the same parameters be generated (default: 1)

number_of_events

number of events (a single positive integer, >= 1)

func

distribution function to be repeated (e.g. runif, rlnorm, rnorm)

...

further parameters passed to func

Value

data.frame with columns repeatID, eventID and values

References

Sonnenberg H (2024). kwb.utils: General Utility Functions Developed at KWB. R package version 0.15.0 URL: https://github.com/kwb-r/kwb.utils (MIT Licence)

Examples

 distribution_repeater(
   number_of_repeatings = 2,
   number_of_events = 10,
   func = runif,
   min = 1,
   max = 10
)
#>    repeatID eventID   values
#> 1         1       1 1.671863
#> 2         1       2 1.588853
#> 3         1       3 8.256173
#> 4         1       4 7.704268
#> 5         1       5 8.503911
#> 6         1       6 2.140611
#> 7         1       7 9.727785
#> 8         1       8 7.911824
#> 9         1       9 2.686206
#> 10        1      10 7.730089
#> 11        2       1 3.882854
#> 12        2       2 1.944603
#> 13        2       3 8.655314
#> 14        2       4 2.450245
#> 15        2       5 8.469875
#> 16        2       6 6.891772
#> 17        2       7 7.406336
#> 18        2       8 4.602820
#> 19        2       9 5.998492
#> 20        2      10 1.623739