tw_filter_people: Filter search result and keep only people

View source: R/tw_filter.R

tw_filter_peopleR Documentation

Filter search result and keep only people

Description

A wrapper of tw_filter() that defaults to keep only "instance of" (P31) "human being" (Q5).

Usage

tw_filter_people(
  search,
  language = tidywikidatar::tw_get_language(),
  limit = 10,
  stop_at_first = TRUE,
  wait = 0,
  overwrite_cache = FALSE,
  cache_connection = NULL,
  disconnect_db = TRUE
)

Arguments

search

A data frame generated by tw_search(), or a search query. If a data frame is given, language and limits are ignore.

language

Language to be used for the search.

limit

Maximum numbers of responses to be given.

stop_at_first

Logical, defaults to TRUE. If TRUE, returns only the first match from the search that satisfies the criteria.

wait

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.

overwrite_cache

Defaults to FALSE. If TRUE, overwrites cache.

cache_connection

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).

disconnect_db

Defaults to TRUE. If FALSE, leaves the connection to cache open.

Value

A data frame with three columns, id, label, and description; all rows refer to a human being.

Examples

tw_search("Ruth Benedict")

tw_search("Ruth Benedict") %>%
  tw_filter_people()

tidywikidatar documentation built on March 31, 2023, 9:08 p.m.