Learn R Programming

wikifacts (version 0.4.2)

wiki_query: Send queries to Wikidata and receive results as dataframe

Description

`wiki_query()` sends a SPARQL query to Wikidata and collects the results in a dataframe

Usage

wiki_query(qry)

Arguments

qry

A character string representing a SPARQL query to be sent to Wikidata

Value

A dataframe of results

Examples

Run this code
# NOT RUN {
# List five diseases
query <- 'SELECT ?itemLabel WHERE {
  ?item wdt:P31 wd:Q12136. #instance of disease
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 5'
wiki_query(query)
# }

Run the code above in your browser using DataLab