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
charlatanfraudster() - 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] "Heritage manager" "Metallurgist" "Drilling engineer"
ch_job(locale = "fr_FR", n = 3)
#> [1] "Collecteur de fonds" "Enseignant humanitaire" "Attaché de presse"
ch_job(locale = "hr_HR", n = 3)
#> [1] "Radiološki tehničar" "Mornar" "Muzejski tehničar"
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 Harold Jacobson Prison officer 816.569.9033
#> 2 Miss Alberta Zemlak Industrial buyer (761)717-0179x128
#> 3 Alwine Wilderman Investment analyst 138-833-2846x93806
#> 4 Archer Kris Psychiatrist 913.613.8520x12840
#> 5 Tyron Robel Visual merchandiser 1-726-853-9169x207…
#> 6 Alyssa Frami-Emmerich Secretary/administrator 521-282-9457x52196
#> 7 Dolly Streich-Dibbert Chartered certified accountant 470.732.0211x047
#> 8 Delton Stoltenberg-Okuneva Glass blower/designer 01660790061
#> 9 Mr. Harlan Jaskolski PhD Minerals surveyor 1-425-137-3103
#> 10 Hanson Okuneva I Hospital doctor (847)712-3285ch_generate("job", "phone_number", n = 30)
#> # A tibble: 30 × 2
#> job phone_number
#> <chr> <chr>
#> 1 Editor, film/video (682)615-9595x4351
#> 2 Therapist, music +03(8)9779937997
#> 3 Scientist, research (medical) 1-594-408-1526x687
#> 4 Private music teacher 07156682201
#> 5 Freight forwarder 00074471576
#> 6 Investment banker, operational +54(9)4078753668
#> 7 Microbiologist 1-182-954-3424x9514
#> 8 Insurance account manager +72(5)1888063914
#> 9 Lexicographer 184-907-6409x99937
#> 10 Designer, blown glass/stained glass 310-190-0249
#> # ℹ 20 more rowsWe 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] "Voyager" "JCB 16 digit" "VISA 16 digit" "VISA 16 digit"ch_credit_card_number()
#> [1] "54547284984936252"
ch_credit_card_number(n = 10)
#> [1] "4028766185780305" "3015379419052595" "869956450422302711"
#> [4] "4043988688884035" "869959909231579253" "180056449817554217"
#> [7] "54932349098524568" "3491740779644641" "6011444792368897464"
#> [10] "6011546714299544889"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.