Skip to content

Instantly share code, notes, and snippets.

@andrawaag
Created May 25, 2017 06:56
Show Gist options
  • Save andrawaag/52345c58c644c4a3cd9e623c5b8edfc3 to your computer and use it in GitHub Desktop.
Save andrawaag/52345c58c644c4a3cd9e623c5b8edfc3 to your computer and use it in GitHub Desktop.
R script that uses the WikidataQueryServiceR library. It scrapes the example from the Wikidata example page https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples. See line 4 on how
library(WikidataQueryServiceR)
library(rvest)
library(urltools)
sparql_query <- scrape_example(c("Variant counts by predictor type"))
results <- query_wikidata(sparql_query)
barplot(results$counts, main="Variant counts by predictor type",
las=2, names.arg=results$propertyLabel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment