R interface to Wikipedia API
if(!require("devtools")){
install.packages("devtools")
library("devtools")
}
install_github("chainsawriot/pediarr")
pediasearch("ukulele")
pediasearch("ukulele", extract = TRUE, limit = 1)
pediasearch("Python")
pediasearch("Python", namespace = 14) # search for categories
pediasearch("Dynamically typed programming languages", namespace = 14, limit = 1)
pediaextract("Hong_Kong")
pediaextract("Hong Kong") # smart enough to replace space with underscore
pediaextract("Hong_Kong", lang="es")
sapply(pediasearch("ukulele"), pediaextract) # it is not a good practice, use pediasearch("ukulele", extract = TRUE)
# Multiple extracts from one query
pediaextract(c("R.E.M.", "Nirvana (band)", "Pearl Jam"))
fulltext <- pediafulltext("Albert Einstein", format = 'text') # extremely messy, need to cleanup
wikitext <- pediafulltext("Albert Einstein", format = 'wikimarkup')
htmltext <- pediafulltext("Albert Einstein", format = 'html')
pediacategory("Category:Dynamically typed programming languages")
pediacategory("Category:Dynamically typed programming languages", cmtype = 'page') # ignore subcat and files
pedialang("Albert Einstein")
pedialang("米", lang = "ja", lllang = "de")
pedialang("앨런_튜링", lang = "ko", lllang = "en")
pedialang("John_McCarthy_(computer_scientist)", lllang = "zh")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.