Skip to contents

A set of generators for character vectors.

Usage

character_(len = c(1L, 10L), any_na = FALSE, any_empty = FALSE)

character_letters(len = c(1L, 10L), any_na = FALSE, any_empty = FALSE)

character_numbers(len = c(1L, 10L), any_na = FALSE, any_empty = FALSE)

character_alphanumeric(len = c(1L, 10L), any_na = FALSE, any_empty = FALSE)

Arguments

len

Length of the generated vectors. If len is a single number all vectors will have this length. If len is a numeric vector of length 2 it will produce vectors with lengths between a minimum and maximum, inclusive. For example len = c(1L, 10L) would produce vectors with lengths between 1 and 10. To produce empty vectors set len = 0L or a range like len = c(0L, 10L).

any_na

Whether NA values should be allowed.

any_empty

Whether empty character values should be allowed.

Value

A quickcheck_generator object.

Examples

character_() %>% show_example()
#> [1] "`stC/u<="   "'[C!S&@s"   "!|5X"       "rI"         "U"         
#> [6] "JrV'"       "PF;$\"Q`iJ" "{$"        
character_(len = 10L, any_na = TRUE) %>% show_example()
#>  [1] NA         NA         " IICyL%"  "37/{s8a"  "=upZs\\"  "|qB48"   
#>  [7] "4P&-s|h " "Vx'CV"    NA         NA        
character_(len = 10L, any_empty = TRUE) %>% show_example()
#>  [1] "!"          "5Uz^d\\+9*" ""           "R>]fzmU"    ""          
#>  [6] "NxeHjML"    ""           ""           "h"          ""