charlatan
makes
realistic looking fake data, inspired from and borrowing some code from
Python’s faker
Why would you want to make fake data that looks real? Here’s some possible use cases to give you a sense for what you can do with this package:
See the Creating realistic data vignette for a few realistic examples.
See the Contributing to charlatan vignette.
R6
objects that
a user can initialize and then call methods on. These contain all the
logic that the below interfaces use.ch_*()
that wrap low level interfaces, and are meant to be
easier to use and provide an easy way to make many instances of a
thing.ch_generate()
- generate a data.frame with fake data,
choosing which columns to include from the data types provided in
charlatan
fraudster()
- single interface to all fake data
methods, - returns vectors/lists of data - this function wraps the
ch_*()
functions described aboveStable version from CRAN
Development version from Github
… for all fake data operations
Here we create 3 jobs, for different locales:
ch_job(locale = "en_US", n = 3)
#> [1] "Dealer" "Radiographer, therapeutic"
#> [3] "Technical author"
ch_job(locale = "fr_FR", n = 3)
#> [1] "Responsable qualité en agroalimentaire"
#> [2] "Ingénieur"
#> [3] "Architecte réseau"
ch_job(locale = "hr_HR", n = 3)
#> [1] "Doktor medicine specijalist"
#> [2] "Strojovođa"
#> [3] "Lektor hrvatskog jezika na stranim visokoškolskim ustanovama"
ch_job(locale = "uk_UA", n = 3)
#> [1] "Різноробочий" "Дипломат" "Хімік"
ch_job(locale = "zh_TW", n = 3)
#> [1] "消防員" "金融專業主管" "噴漆人員"
For colors:
ch_generate()
#> # A tibble: 10 × 3
#> name job phone_number
#> <chr> <chr> <chr>
#> 1 Ceylon Lebsack Dealer (588)061-33…
#> 2 Elizebeth Wuckert DDS Educational psychologist 1-224-099-3…
#> 3 Christina Rippin Engineer, manufacturing systems 478-103-5363
#> 4 Mr. Arnold Jacobson II Geneticist, molecular 293-216-523…
#> 5 Ms. Cheyanne Reilly DDS Data scientist (056)881-09…
#> 6 Quiana Braun Public librarian 193-685-6079
#> 7 Tania Toy Nurse, learning disability 1-735-857-9…
#> 8 Rita Willms MD Programme researcher, broadcasting/film… 145.798.8635
#> 9 Joesph Mohr-Macejkovic Midwife 822.667.714…
#> 10 Shayla VonRueden Manufacturing systems engineer 347-706-601…
ch_generate("job", "phone_number", n = 30)
#> # A tibble: 30 × 2
#> job phone_number
#> <chr> <chr>
#> 1 Administrator, charities/voluntary organisations 593.799.0708x01403
#> 2 Animator 1-353-748-9380x99890
#> 3 Landscape architect (375)572-7358x9616
#> 4 Statistician (771)149-8667x98900
#> 5 Actor (260)995-7929
#> 6 Charity officer (454)393-4678x4059
#> 7 Scientist, marine +60(4)4065022481
#> 8 Public relations account executive 1-634-306-9349x141
#> 9 Minerals surveyor (847)854-7452x5844
#> 10 Surveyor, hydrographic (133)359-8286
#> # ℹ 20 more rows
We can create locale specific versions of:
Examples:
Some data types are not localized (arguably the files and user_agents, are mostly universal too).
ch_credit_card_provider()
#> [1] "VISA 13 digit"
ch_credit_card_provider(n = 4)
#> [1] "Diners Club / Carte Blanche" "Diners Club / Carte Blanche"
#> [3] "VISA 16 digit" "VISA 13 digit"
ch_credit_card_number()
#> [1] "3022063028304257"
ch_credit_card_number(n = 10)
#> [1] "3730556673316993" "55214044527090088" "4301970046795670"
#> [4] "4042098116698964" "3158620602814460500" "51140396202432590"
#> [7] "4919149215373189" "869971396775493857" "3488859328037423"
#> [10] "3430356121738033"
charlatan
makes it very easy to generate fake data with
missing entries. First, you need to run
MissingDataProvider()
and then make an appropriate
make_missing()
call specifying the data type to be
generated. This method picks a random number (N
) of slots
in the input make_missing
vector and then picks
N
random positions that will be replaced with NA matching
the input class.
Real data is messy, right? charlatan
makes it easy to
create messy data. This is still in the early stages so is not available
across most data types and languages, but we’re working on it.
For example, create messy names:
ch_name(50, messy = TRUE)
#> [1] "Destiney Dicki" "Mrs. Freddie Pouros DDS"
#> [3] "Ms. Jada Lesch" "Inga Dach"
#> [5] "Keyshawn Schaefer" "Ferdinand Bergstrom"
#> [7] "Justen Simonis" "Ms. Doloris Stroman DVM"
#> [9] "Mrs. Ermine Heidenreich" "Marion Corwin"
#> [11] "Jalen Grimes" "Mr. Sullivan Hammes IV"
#> [13] "Adrien Vandervort-Dickens" "Dr. Sharif Kunde"
#> [15] "Marlena Reichert PhD" "Mr. Brandan Oberbrunner"
#> [17] "Lloyd Adams III" "Randy Ziemann"
#> [19] "Gina Sanford" "Cornell Funk"
#> [21] "Yadiel Collier" "Kamryn Johnson"
#> [23] "Tyesha Schmeler" "Ernie Hegmann-Graham"
#> [25] "Zackery Runolfsdottir" "Cleveland Predovic"
#> [27] "Melvyn Hickle" "Larry Nienow IV"
#> [29] "Vilma Rutherford" "Wiliam Ziemann-Fadel"
#> [31] "Mrs. Kathy Halvorson" "Mirtie Harvey-Shanahan"
#> [33] "Eliezer Pfeffer" "Dr. Shep Buckridge"
#> [35] "Kyree Kutch" "Ms. Delpha Grant"
#> [37] "Ms. Icie Crooks" "Loney Jenkins-Lindgren"
#> [39] "Shania Donnelly DVM" "Dr. Patric Veum"
#> [41] "Amirah Rippin DVM" "Randle Hilpert"
#> [43] "Soren Dare" "Roderic Walter"
#> [45] "Farah Daugherty MD" "Marva Crooks"
#> [47] "Ryland Ledner" "Girtha Harvey DDS"
#> [49] "Staci Spencer" "Mr. Olan Bernhard"
Right now only suffixes and prefixes for names in en_US
locale are supported. Notice above some variation in prefixes and
suffixes.