genderizeAPI: Getting data from genderize.io API

Description Usage Arguments Value Examples

View source: R/genderizeAPI.R

Description

The genderizeAPI function connects to genderize.io API and checks if a term (one or more) is in the genderize.io database and returns predicted gender probability and count of the records with this term in the database.

Usage

1
2
genderizeAPI(x, country = NULL, language = NULL, apikey = NULL,
  ssl.verifypeer = TRUE)

Arguments

x

A vector of terms to check in genderize.io database.

country

A character string with a country code for localized search of names. Country codes follow the ISO_3166-1 alpha-2 standard https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.

language

A character string with a language code for localized search of names. Language codes follow the ISO_639-1 standard: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

apikey

A character string with the API key obtained via https://store.genderize.io. A default is NULL, which uses the free API plan. If you reached the limit of the API you can start from the last checked term next time.

ssl.verifypeer

If TRUE (default) it checks the SSL Certificate.

Value

A list of four elements: response is a data frame with names, genders, probabilities and counts or NULL if no terms are found in the genderize.io database; limitLeft is showing how many API queries are still possible within the current limit which will be renewed in limitReset seconds.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 

terms = c("loremipsum")
genderizeAPI(terms)$response
# Null data.table (0 rows and 0 cols)

terms = c("jan", "maria", "norbert", "winston", "loremipsum")
genderizeAPI(terms)
 
# example of the function output 
$response
      name gender probability count
      1:     jan   male        0.60  1692
      2:   maria female        0.99  8467
      3: norbert   male        1.00    77
      4: winston   male        0.98   128

$limitLeft
[1] 967

$limit
[1] 1000

$limitReset
[1] 83234 


## End(Not run)

genderizeR documentation built on Aug. 4, 2019, 5:02 p.m.