Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

R SPARQL Wikidata: "Opening and ending tag mismatch"

$
0
0

My aim is to query wikidata using R. I just realized that the "Wikidata Query Service" offers code examples in order to so:

1. Go to https://w.wiki/AkK
2. Execute query
3. Click on Code next to the Download button
4. Select R. This gives the following result:

#http://www.r-bloggers.com/sparql-with-r-in-less-than-5-minutes/

library(SPARQL) # SPARQL querying package
library(ggplot2)

endpoint <- "https://query.wikidata.org/sparql"
query <- 'SELECT  (COUNT(?item) AS ?count) \n{\n  ?item wdt:P31 wd:Q146.\n  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }\n} '

qd <- SPARQL(endpoint,query)
df <- qd$results

When I run this code the following error message appears: "Opening and ending tag mismatch". The problem seems to be platform independent. What do I need to do in order to avoid getting this error message?


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>