Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chainsawriot/pediarr
R interface to Wikipedia API
https://github.com/chainsawriot/pediarr
Last synced: 27 days ago
JSON representation
R interface to Wikipedia API
- Host: GitHub
- URL: https://github.com/chainsawriot/pediarr
- Owner: chainsawriot
- Created: 2015-03-26T15:02:06.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-01T01:36:23.000Z (over 9 years ago)
- Last Synced: 2023-03-23T17:29:43.158Z (over 1 year ago)
- Language: R
- Homepage:
- Size: 152 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pediarr
R interface to Wikipedia API
# Package Installation
```r
if(!require("devtools")){
install.packages("devtools")
library("devtools")
}
install_github("chainsawriot/pediarr")
```## Features
* Search Wikipedia
```r
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)
```* Retrieve extract(s) of Wikipedia article
```r
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"))
```* Experimental: retrieve the full text of Wikipedia article
```r
fulltext <- pediafulltext("Albert Einstein", format = 'text') # extremely messy, need to cleanup
wikitext <- pediafulltext("Albert Einstein", format = 'wikimarkup')
htmltext <- pediafulltext("Albert Einstein", format = 'html')
```* List out members of Wikipedia category
```r
pediacategory("Category:Dynamically typed programming languages")
pediacategory("Category:Dynamically typed programming languages", cmtype = 'page') # ignore subcat and files
```* Retrieve the wikipedia title in other language
```r
pedialang("Albert Einstein")
pedialang("米", lang = "ja", lllang = "de")
pedialang("앨런_튜링", lang = "ko", lllang = "en")
pedialang("John_McCarthy_(computer_scientist)", lllang = "zh")
```