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

Roel M. Hogervorst hogervorst.rm@gmail.com

Scott Chamberlain

Kyle Voytovich

Martin Pedersen

Examples

# generate individual types of data
ch_name()
#> [1] "Pauline Friesen PhD"
ch_phone_number()
#> [1] "(246)567-3200x33122"
ch_job()
#> [1] "Educational psychologist"

# generate a data.frame
ch_generate()
#> # A tibble: 10 × 3
#>    name                    job                                phone_number      
#>    <chr>                   <chr>                              <chr>             
#>  1 Michael Kertzmann-Rau   Amenity horticulturist             1-030-943-2684    
#>  2 Kyree Corwin            Financial planner                  267.904.8890x65011
#>  3 Axel Skiles             Psychotherapist                    677-085-6299      
#>  4 Judge Little            Community pharmacist               1-330-783-0993x00…
#>  5 Willa Nitzsche          Public relations account executive 240.934.5466x29527
#>  6 Ms. Brigitte Maggio PhD Records manager                    1-107-051-8666x180
#>  7 Sibyl Muller            Ceramics designer                  365-045-6890x260  
#>  8 Clare Beier             Musician                           707.473.6109x4506 
#>  9 Mr. Garfield Sawayn PhD Investment analyst                 +37(1)6940759022  
#> 10 Marisol Corwin PhD      Legal executive                    371.062.8192x10880

# 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] "Sub"
x$name()
#> [1] "Miss Sydney Langosh"
x$color_name()
#> [1] "ForestGreen"
x$hex_color()
#> [1] "#ACDEC5"

# 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_en_US$new()
x$color_name()
#> [1] "OrangeRed"
x$hex_color()
#> [1] "#0691A8"