A set of generators for double vectors.
Usage
double_(
len = c(1L, 10L),
any_na = FALSE,
any_nan = FALSE,
any_inf = FALSE,
big_dbl = FALSE
)
double_bounded(
left,
right,
len = c(1L, 10L),
any_na = FALSE,
any_nan = FALSE,
any_inf = FALSE
)
double_left_bounded(
left,
len = c(1L, 10L),
any_na = FALSE,
any_nan = FALSE,
any_inf = FALSE,
big_dbl = FALSE
)
double_right_bounded(
right,
len = c(1L, 10L),
any_na = FALSE,
any_nan = FALSE,
any_inf = FALSE,
big_dbl = FALSE
)
double_positive(
len = c(1L, 10L),
any_na = FALSE,
any_nan = FALSE,
any_inf = FALSE,
big_dbl = FALSE
)
double_negative(
len = c(1L, 10L),
any_na = FALSE,
any_nan = FALSE,
any_inf = FALSE,
big_dbl = FALSE
)
double_fractional(
len = c(1L, 10L),
any_na = FALSE,
any_nan = FALSE,
any_inf = FALSE,
big_dbl = FALSE
)
double_whole(
len = c(1L, 10L),
any_na = FALSE,
any_nan = FALSE,
any_inf = FALSE,
big_dbl = FALSE
)
Arguments
- len
Length of the generated vectors. If
len
is a single number all vectors will have this length. Iflen
is a numeric vector of length 2 it will produce vectors with lengths between a minimum and maximum, inclusive. For examplelen = c(1L, 10L)
would produce vectors with lengths between 1 and 10. To produce empty vectors setlen = 0L
or a range likelen = c(0L, 10L)
.- any_na
Whether
NA
values should be allowed.- any_nan
Whether
NaN
values should be allowed.- any_inf
Whether
Inf
/-Inf
values should be allowed.- big_dbl
Should doubles near the maximum size be included? This may cause problems because if the result of a computation results in a double larger than the maximum it will return
Inf
.- left
The minimum possible value for generated numbers, inclusive.
- right
The maximum possible value for generated numbers, inclusive.
Examples
double_() %>% show_example()
#> [1] -896757909 0 -548095398 288346909 -416675263 790017647 518964321
#> [8] -298808624
double_(big_dbl = TRUE) %>% show_example()
#> [1] 5.542566e+307 8.131943e+307 4.027915e+306
double_bounded(left = -5, right = 5) %>% show_example()
#> [1] -2.849737 -3.460845 2.118681 -4.210345 0.000000 4.763344 2.292785
#> [8] -1.782531 -4.965854 -3.949224
double_(len = 10L, any_na = TRUE) %>% show_example()
#> [1] NA NA NA NA 0 764252448
#> [7] -662940983 201207581 NA -845955689
double_(len = 10L, any_nan = TRUE, any_inf = TRUE) %>% show_example()
#> [1] -Inf -Inf 349496941 -992469097 NaN 810911845
#> [7] 987752591 -Inf -593595623 0