A set of generators for integer vectors.
Usage
integer_(len = c(1L, 10L), any_na = FALSE, big_int = FALSE)
integer_bounded(left, right, len = c(1L, 10L), any_na = FALSE)
integer_left_bounded(left, len = c(1L, 10L), any_na = FALSE, big_int = FALSE)
integer_right_bounded(right, len = c(1L, 10L), any_na = FALSE, big_int = FALSE)
integer_positive(len = c(1L, 10L), any_na = FALSE, big_int = FALSE)
integer_negative(len = c(1L, 10L), any_na = FALSE, big_int = 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.- big_int
Should integers near the maximum size be included? This may cause problems because if the result of a computation results in an integer larger than the maximum it will be silently coerced it to a double.
- left
The minimum possible value for generated numbers, inclusive.
- right
The maximum possible value for generated numbers, inclusive.
Examples
integer_() %>% show_example()
#> [1] -2298 -5205 4838 2083 1889 -2968 0 7864
integer_(big_int = TRUE) %>% show_example()
#> [1] 497496939 1697796661 128350288 -1658385106
integer_bounded(left = -5L, right = 5L) %>% show_example()
#> [1] -1 4 -2 2
integer_(len = 10L, any_na = TRUE) %>% show_example()
#> [1] 1863 2544 NA -6266 -1779 NA 1590 9751 -4503 NA