Find if a string refers to a person, and if so, finds gender by searching Wikidata

find_gender(search, language = "en", description_language = "en",
  cache = TRUE, wait = 0.1, only_cached = FALSE,
  exclude_without_uppercase = TRUE, quietly = FALSE)

Arguments

search

The query to be searched.

language

Two letters language codes to be passed to WikiData to determine search results; it works similarly as looking in the corresponding version of Wikipedia.

description_language

The language in which preferably to return the description as a two letter code. If not available, defaults to English. If English is not available, defaults to the language used to search in Wikidata. If not available, it returns NA.

cache

Logical, defaults to TRUE. IF TRUE, it stores data on the search string and the resulting Wikidata object. Data are stored inside a `wikidata` folder (if it does not exist, it is automatically created).

wait

Numeric, defaults to 0.1. Waiting time between queries, relevant when making a large number of queries.

only_cached

Logical, defaults to FALSE. If TRUE, it only uses locally cached information.

exclude_without_uppercase

Logical, degaults to TRUE. If the search string does not include any upper case letter, then assume it's not a person.

quietly

Logical, defaults to FALSE. If TRUE, no warning message appears when no relevent Wikidata entry is found.

Value

A data.frame (a tibble) with one row and four columns: Query, Gender, Description, and WikidataID

Examples

find_gender(search = "Garibaldi", language = "it")
#> # A tibble: 1 x 4 #> Query Gender Description WikidataID #> <chr> <chr> <chr> <chr> #> 1 Garibaldi male Italian general and politician Q539