knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

DemografixeR

CRAN status Travis build status AppVeyor build status Codecov test coverage

'DemografixeR' allows to estimate gender, age & nationality from a name. The package is an API wrapper of all 3 'Demografix' API's - all three APIs supported in one package:

Documentation

You can find all the necessary documentation about the package here:

Installation

You can install the CRAN release version of DemografixeR following this R command:

install.packages("DemografixeR")

You can also install the development version of DemografixeR following these R commands:

if (!require("devtools")) install.packages("devtools")
devtools::install_github("matbmeijer/DemografixeR")

Examples

These are basic examples, which shows you how to estimate nationality, gender and age by a given name with & without specifying a country. The package takes care of multiple background tasks:

library(DemografixeR)

#Simple example without country_id
names<-c("Ben", "Allister", "Lucie", "Paula")
genderize(name = names)
nationalize(name = names)
agify(name = names)

#Simple example with
genderize(name = names, country_id = "US")
agify(name = names, country_id = "US")

#Workflow example with dplyr with missing values and multiple different countries
df<-data.frame(names=c("Ana", NA, "Pedro",
                       "Francisco", "Maria", "Elena"),
                 country=c(NA, NA, "ES",
                           "DE", "ES", "NL"), stringsAsFactors = FALSE)

df %>% dplyr::mutate(guessed_nationality=nationalize(name = names),
                guessed_gender=genderize(name = names, country_id = country),
                guessed_age=agify(name = names, country_id = country)) %>% 
  knitr::kable()

#Detailed data.frame example:
genderize(name = names, simplify = FALSE, meta = TRUE) %>% knitr::kable()

Disclaimer

Code of Conduct

Please note that the 'DemografixeR' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

MIT © Matthias Brenninkmeijer



matbmeijer/DemografixeR documentation built on May 21, 2020, 4:31 p.m.