I wish to scrape the following wiki article: http://en.wikipedia.org/wiki/Periodic_table
So that the output of my R code will be a table with the following columns:
Do you have to scrape Wikipedia? You can run this SPARQL query against Wikidata instead (results):
SELECT
?elementLabel
?symbol
?article
WHERE
{
?element wdt:P31 wd:Q11344;
wdt:P1086 ?n;
wdt:P246 ?symbol.
OPTIONAL {
?article schema:about ?element;
schema:inLanguage "en";
schema:isPartOf .
}
FILTER (?n >= 1 && ?n <= 118).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?n
Sorry if this doesn't answer your question directly but this should help people looking to scrape the same information but in a clean manner.