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:
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
install.packages("charlatan")
Development version from Github
devtools::install_github("ropensci/charlatan")
library("charlatan")
… for all fake data operations
x <- fraudster()
x$job()
#> [1] "Chief Technology Officer"
x$name()
#> [1] "Gottlieb Greenfelder"
x$job()
#> [1] "Scientist, product/process development"
x$color_name()
#> [1] "DarkViolet"
Adding more locales through time, e.g.,
Locale support for job data
ch_job(locale = "en_US", n = 3)
#> [1] "Housing manager/officer" "Theme park manager"
#> [3] "Office manager"
ch_job(locale = "fr_FR", n = 3)
#> [1] "Auxiliaire spécialisé vétérinaire" "Économe de flux"
#> [3] "Bottier"
ch_job(locale = "hr_HR", n = 3)
#> [1] "Klobučar" "Graditelj brodova" "Pismoslikar"
ch_job(locale = "uk_UA", n = 3)
#> [1] "Програміст" "Професор" "Дерун"
ch_job(locale = "zh_TW", n = 3)
#> [1] "農藝/畜產研究人員" "軟體專案管理師" "系統整合/ERP專案師"
For colors:
ch_color_name(locale = "en_US", n = 3)
#> [1] "SandyBrown" "DarkSlateGray" "PowderBlue"
ch_color_name(locale = "uk_UA", n = 3)
#> [1] "Лимонно-кремовий" "Блідо-каштановий"
#> [3] "Помаранчево-персиковий"
More coming soon …
ch_generate()
#> # A tibble: 10 x 3
#> name job phone_number
#> <chr> <chr> <chr>
#> 1 Kassie Leffler Ecologist 490.780.0864
#> 2 Tierra Watsica Insurance account manager (452)316-8793x9081
#> 3 Debbi Harber Engineer, chemical 1-301-135-5169x984
#> 4 Jeramie Walter Editorial assistant (665)154-2744x2274
#> 5 Rickie Morissette Restaurant manager 1-329-085-4956
#> 6 Julio Farrell Corporate treasurer 720-855-1751x2252
#> 7 Sherie Gislason Plant breeder/geneticist 767-335-0245
#> 8 Lucinda Armstrong Radiation protection practitioner 02079832938
#> 9 Carrol Howe MD Contracting civil engineer +68(4)9165838423
#> 10 Dr. Socorro Schmitt Designer, furniture 852-928-8670
ch_generate('job', 'phone_number', n = 30)
#> # A tibble: 30 x 2
#> job phone_number
#> <chr> <chr>
#> 1 Legal secretary (606)596-6104
#> 2 Emergency planning/management officer +99(0)0779574693
#> 3 Food technologist 07047666301
#> 4 Quality manager 936.390.4298
#> 5 Economist +25(9)7508933600
#> 6 Actor (977)091-9322
#> 7 Civil Service fast streamer 770.644.3003x529
#> 8 Acupuncturist 703-830-2719x354
#> 9 Lobbyist (494)107-0538x3345
#> 10 Health promotion specialist 1-231-435-4566x864
#> # ... with 20 more rows
ch_name()
#> [1] "Eulalia Walker-Hand"
ch_name(10)
#> [1] "Lular Schulist" "Miss Willie Mante DDS"
#> [3] "Kole Price" "Kinsey Hahn"
#> [5] "Lindy Hettinger" "Myron Miller"
#> [7] "Clara O'Kon-Bosco" "Lakisha Murazik"
#> [9] "Ms. Aiyanna Ernser" "Regenia Crooks"
ch_phone_number()
#> [1] "225-861-1056"
ch_phone_number(10)
#> [1] "(397)709-4341x8258" "588-372-5015x37545" "613-137-7911x883"
#> [4] "1-600-128-4597x99950" "670-069-8527x6732" "658.651.4977x94270"
#> [7] "+46(6)3770984906" "1-546-751-0949" "(459)629-1280x4323"
#> [10] "+20(2)7575786577"
ch_job()
#> [1] "Contracting civil engineer"
ch_job(10)
#> [1] "Diplomatic Services operational officer"
#> [2] "Exhibitions officer, museum/gallery"
#> [3] "Clinical psychologist"
#> [4] "Interpreter"
#> [5] "Electrical engineer"
#> [6] "Sports coach"
#> [7] "Radio broadcast assistant"
#> [8] "Museum/gallery exhibitions officer"
#> [9] "Broadcast engineer"
#> [10] "Personal assistant"
ch_credit_card_provider()
#> [1] "VISA 16 digit"
ch_credit_card_provider(n = 4)
#> [1] "VISA 16 digit" "Mastercard" "Mastercard" "VISA 16 digit"
ch_credit_card_number()
#> [1] "55102041677140379"
ch_credit_card_number(n = 10)
#> [1] "6011605711290457945" "3041537239690522" "3112768344523864506"
#> [4] "4486249701104" "4253802266283" "4992229219738163"
#> [7] "4672722860615828" "4987676760612" "4752221113018"
#> [10] "3764355598669753"
ch_credit_card_security_code()
#> [1] "711"
ch_credit_card_security_code(10)
#> [1] "395" "324" "582" "562" "227" "595" "574" "110" "050" "275"
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] "Cason Hagenes" "Angela Cassin"
#> [3] "Drew Ritchie" "Math Bergnaum"
#> [5] "Wash Brown" "Ransom Green-Keebler"
#> [7] "Elick Boyer DDS" "Joretta Hirthe"
#> [9] "Dr Solon Schneider" "Jaden D'Amore"
#> [11] "Delmas Schmidt" "Ramiro Howell-Goldner"
#> [13] "Margarett Pouros DVM" "Una McClure"
#> [15] "Miracle Yost m.d." "Dr Beaulah Vandervort Ph.D."
#> [17] "Yadira Grimes" "Holland Koch"
#> [19] "Migdalia Flatley" "Miss Ferne Haag"
#> [21] "Dr Chelsi Jaskolski" "Maryanne Heaney"
#> [23] "Gerold Klein" "Dr. Stephon Kreiger"
#> [25] "Lydell Abernathy Sr." "Ms Della Gulgowski"
#> [27] "Boyd Quitzon" "Jerald Kerluke"
#> [29] "Dr Domenick Mills" "Dr. Thurlow Connelly"
#> [31] "Raheem Robel" "Britney O'Keefe-Greenholt"
#> [33] "Kacey Hane" "Germaine Feeney"
#> [35] "Myrta Rosenbaum" "Dequan Sawayn"
#> [37] "Harvie Crona" "Adelyn Feest-Wehner"
#> [39] "Corda Jerde" "Savon Armstrong"
#> [41] "Summer Cartwright" "Chyna Stehr-Schiller"
#> [43] "Levie Torphy" "Anne Tillman"
#> [45] "Nana Abbott" "Dr. Neta Funk"
#> [47] "Dr. Vance Stracke" "Love Bogan"
#> [49] "Laquita Bartell" "Nikolas Block-Beatty"
Right now only suffixes and prefixes for names in en_US
locale are supported. Notice above some variation in prefixes and suffixes.