Skip to contents

Make fake data, supporting addresses, person names, dates, times, colors, coordinates, currencies, digital object identifiers (DOIs), jobs, phone numbers, DNA sequences, doubles and integers from distributions and within a range.

Package API

  • ch_generate(): generate a data.frame with fake data

  • fraudster(): single interface to all fake data methods

  • High level interfaces: There are high level functions prefixed with ch_ that wrap low level interfaces, and are meant to be easier to use and provide easy way to make many instances of a thing.

  • Low level interfaces: All of these are R6 objects that a user can initialize and then call methods on the them.

Author

Scott Chamberlain [email protected]

Kyle Voytovich

Martin Pedersen

Examples

# generate individual types of data
ch_name()
#> [1] "Gloria Dicki"
ch_phone_number()
#> [1] "299.766.2669x779"
ch_job()
#> [1] "Visual merchandiser"

# generate a data.frame
ch_generate()
#> # A tibble: 10 × 3
#>    name                      job                                    phone_number
#>    <chr>                     <chr>                                  <chr>       
#>  1 Ashli King                Chemist, analytical                    1-676-519-2…
#>  2 Tamisha Littel            Administrator, Civil Service           +10(6)77406…
#>  3 Sharon Hintz              Leisure centre manager                 1-561-106-6…
#>  4 Miss Alexandra Raynor     Armed forces logistics/support/admini… 523-361-324…
#>  5 Mr. Aldo Anderson Sr.     Geoscientist                           344.953.050…
#>  6 Keisha Beer               Designer, textile                      788.090.710…
#>  7 Dr. Thomas Hoppe          Scientist, research (physical science… 772-450-3136
#>  8 Carmine Senger            Civil engineer, consulting             315.585.152…
#>  9 Ezzard Little IV          Geologist, engineering                 (091)979-60…
#> 10 Mr. Marcelino Daugherty I Designer, interior/spatial             008.729.5327

# one interface to all data types - generate the class first
#  reports the locale to be used, can change optionally
(x <- fraudster())
#> <fraudster>
#>   locale: en_US
x$job()
#> [1] "Press photographer"
x$name()
#> [1] "Roosevelt Bartell"
x$color_name()
#> [1] "Blue"
x$hex_color()
#> [1] "#0413AF"

# low level interfaces to "data providers"
# these are exported by hidden from package man page
# as most users will likely not interact with these
x <- ColorProvider$new()
x$color_name()
#> [1] "SkyBlue"
x$hex_color()
#> [1] "#B063D8"