A wrapper of tw_filter() that defaults to keep only "instance of" (P31)
"human being" (Q5).
tw_filter_people(
search,
language = tidywikidatar::tw_get_language(),
response_language = tidywikidatar::tw_get_language(),
limit = 10,
include_search = FALSE,
stop_at_first = TRUE,
wait = 0,
overwrite_cache = FALSE,
cache_connection = NULL,
disconnect_db = TRUE
)A data frame with three columns, id, label, and description;
all rows refer to a human being.
A data frame generated by tw_search(), or a search query. If
a data frame is given, language and limits are ignore.
Language to be used for the search. Can be set once per
session with tw_set_language(). If not set, defaults to "en". For a full
list, see
the
dedicated Wikimedia page.
Language to be used for the returned labels and
descriptions. Corresponds to the uselang parameter of the MediaWiki API,
as described
in
the official documentation. Can be set once per session with
tw_set_language(). If not set, defaults to "en". For a full list, see
all
available language codes.
Maximum numbers of responses to be given.
Logical, defaults to FALSE. If TRUE, the search is
returned as an additional column.
Logical, defaults to TRUE. If TRUE, returns only the first match from the search that satisfies the criteria.
In seconds, defaults to 0. Time to wait between queries to Wikidata. If data are cached locally, wait time is not applied. If you are running many queries systematically you may want to add some waiting time between queries.
Defaults to FALSE. If TRUE, overwrites cache.
Defaults to NULL. If NULL, and caching is
enabled, tidywikidatar will use a local sqlite database. A custom
connection to other databases can be given (see vignette caching for
details).
Defaults to TRUE. If FALSE, leaves the connection to
cache open.
tw_search("Ruth Benedict")
tw_search("Ruth Benedict") %>%
tw_filter_people()
Run the code above in your browser using DataLab