Get Wikidata Item ID

Description

Get Wikidata Item ID

Usage

1
2
get_wdid(query, language = "en", match = c("best", "first", "all", "ask",
  "na"), verbose = TRUE)

Arguments

query

character; The searchterm

language

character; the language to search in

match

character; How should multiple hits be handeled? 'all' returns all matched IDs, 'first' only the first match, 'best' the best matching (by name) ID, 'ask' is a interactive mode and the user is asked for input, 'na' returns NA if multiple hits are found.

verbose

logical; print message during processing to console?

Value

if match = 'all' a list with ids, otherwise a dataframe with 4 columns: id, matched text, string distance to match and the queried string

Note

Only matches in labels are returned.

Author(s)

Eduard Szoecs, eduardszoecs@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
get_wdid('Triclosan', language = 'de')
get_wdid('DDT')
get_wdid('DDT', match = 'all')

# multiple inputs
comps <- c('Triclosan', 'Glyphosate')
get_wdid(comps)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.