A set of generators for numeric vectors. Numeric vectors can be either integer or double vectors.
Usage
numeric_(len = c(1L, 10L), any_na = FALSE, big_num = FALSE)
numeric_bounded(left, right, len = c(1L, 10L), any_na = FALSE)
numeric_left_bounded(left, len = c(1L, 10L), any_na = FALSE, big_num = FALSE)
numeric_right_bounded(right, len = c(1L, 10L), any_na = FALSE, big_num = FALSE)
numeric_positive(len = c(1L, 10L), any_na = FALSE, big_num = FALSE)
numeric_negative(len = c(1L, 10L), any_na = FALSE, big_num = 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_num
Should integers or doubles near the maximum size be included? This may cause problems because if the result of a computation results in a number larger than the maximum an integer will be silently coerced to a double and a double will return
Inf
.- left
The minimum possible value for generated numbers, inclusive.
- right
The maximum possible value for generated numbers, inclusive.
Examples
numeric_() %>% show_example()
#> [1] 1500 3875 -8377 -5401 -1367
numeric_(big_num = TRUE) %>% show_example()
#> [1] 572149 672724392 1432248207 1015662317 162297194
numeric_bounded(left = -5L, right = 5L) %>% show_example()
#> [1] -1.0644474 4.5947855 3.1358975 -0.8570107 0.6891515 4.2261911 -2.4046150
#> [8] 1.7091640 -4.8263062
numeric_(len = 10L, any_na = TRUE) %>% show_example()
#> [1] 9407 0 -7752 3876 572 6024 -1301 -197 0 -1527