charlatan
makes fake
data, inspired from and borrowing some code from Python’s faker
Why would you want to make fake data? Here’s some possible use cases to give you a sense for what you can do with this package:
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
Adding more locales through time, e.g.,
Locale support for job data
ch_job(locale = "en_US", n = 3)
#> [1] "Video editor" "Secretary, company"
#> [3] "Horticultural therapist"
ch_job(locale = "fr_FR", n = 3)
#> [1] "Chanteur"
#> [2] "Monteur en installations thermiques et climatiques"
#> [3] "Agriculteur"
ch_job(locale = "hr_HR", n = 3)
#> [1] "Muzejski pedagog" "Prometni pilot helikoptera"
#> [3] "Muzejski tehničar"
ch_job(locale = "uk_UA", n = 3)
#> [1] "Філолог" "Гінеколог" "Піаніст"
ch_job(locale = "zh_TW", n = 3)
#> [1] "木工" "客戶服務主管" "產品售後技術服務"
For colors:
ch_color_name(locale = "en_US", n = 3)
#> [1] "MediumAquaMarine" "Lime" "PeachPuff"
ch_color_name(locale = "uk_UA", n = 3)
#> [1] "Алізариновий червоний" "Бургундський" "Салатовий"
More coming soon …
ch_generate()
#> # A tibble: 10 × 3
#> name job phone_number
#> <chr> <chr> <chr>
#> 1 Earlean Lindgren Aid worker 01157721726
#> 2 Casey Hoeger-Hegmann Psychologist, forensic 269-638-2802x2211
#> 3 Dr. Arlis Torp Investment banker, operational +06(0)2611322802
#> 4 Mrs. Dortha King DDS Charity fundraiser +86(1)0078412713
#> 5 Braden Kutch-Littel Occupational hygienist 296.008.6550x148
#> 6 Keyon Daniel Therapist, drama (588)560-1486x011
#> 7 Ms. Liane Bartoletti MD Artist 203.456.1788x1648
#> 8 Mr. Bernard Morar Horticulturist, commercial 1-901-013-5943x6685
#> 9 Dr. Son Baumbach Marketing executive (829)243-5202
#> 10 Eunice Schamberger Cabin crew 1-139-831-7205
ch_generate("job", "phone_number", n = 30)
#> # A tibble: 30 × 2
#> job phone_number
#> <chr> <chr>
#> 1 Dancer (717)468-7709x42493
#> 2 Biomedical engineer 600-218-9259x84241
#> 3 TEFL teacher 1-988-231-3123x54942
#> 4 Radio broadcast assistant 218-535-2210x68229
#> 5 Teacher, early years/pre 056-083-8593x975
#> 6 Aid worker 691.037.7879
#> 7 Diagnostic radiographer 1-519-521-1481x027
#> 8 Scientist, research (life sciences) 098.270.4023x07376
#> 9 Forensic scientist 1-485-902-4146
#> 10 Environmental education officer 1-733-250-0232x1255
#> # ℹ 20 more rows
ch_credit_card_provider()
#> [1] "JCB 15 digit"
ch_credit_card_provider(n = 4)
#> [1] "VISA 13 digit" "JCB 16 digit"
#> [3] "VISA 16 digit" "Diners Club / Carte Blanche"
ch_credit_card_number()
#> [1] "210073929714887090"
ch_credit_card_number(n = 10)
#> [1] "3088752600431960498" "869954153174558322" "52045589866105934"
#> [4] "3024514890725589" "869993954021932542" "3158346498311573462"
#> [7] "3476629890594430" "3050377350898955" "869943768098512529"
#> [10] "4902874730754"
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.