judith-bourque / faker

Get data from the Faker API
Other
0 stars 0 forks source link
demo faker-api r-package

faker

R-CMD-check

A Faker API wrapper package in R.

Based on httr2 and built using the workflow outlined in R Packages.

Installation

You can install the development version of faker from GitHub with:

# install.packages("devtools")
devtools::install_github("judith-bourque/faker")

Example

This is a basic example which shows you how to get a person using the Faker API:

library(faker)

str(faker_person("male"))
#> List of 4
#>  $ status: chr "OK"
#>  $ code  : int 200
#>  $ total : int 1
#>  $ data  :List of 1
#>   ..$ :List of 10
#>   .. ..$ id       : int 1
#>   .. ..$ firstname: chr "Justyn"
#>   .. ..$ lastname : chr "Daniel"
#>   .. ..$ email    : chr "prohaska.ruthe@hotmail.com"
#>   .. ..$ phone    : chr "+1109087410639"
#>   .. ..$ birthday : chr "2012-08-30"
#>   .. ..$ gender   : chr "male"
#>   .. ..$ address  :List of 10
#>   .. .. ..$ id            : int 0
#>   .. .. ..$ street        : chr "7741 Makenzie Field Apt. 460"
#>   .. .. ..$ streetName    : chr "Hilpert Inlet"
#>   .. .. ..$ buildingNumber: chr "9772"
#>   .. .. ..$ city          : chr "West Kiana"
#>   .. .. ..$ zipcode       : chr "57001"
#>   .. .. ..$ country       : chr "Togo"
#>   .. .. ..$ county_code   : chr "MK"
#>   .. .. ..$ latitude      : num 25.3
#>   .. .. ..$ longitude     : num -72.8
#>   .. ..$ website  : chr "http://olson.com"
#>   .. ..$ image    : chr "http://placeimg.com/640/480/people"

This package includes a ggplot2 theme inspired by the Faker API: