wikitaxa - Taxonomy data from Wikipedia

The goal of wikitaxa is to allow search and taxonomic data retrieval from across many Wikimedia sites, including: Wikipedia, Wikicommons, and Wikispecies.

There are lower level and higher level parts to the package API:

Low level API

The low level API is meant for power users and gives you more control, but requires more knowledge.

  • wt_wiki_page()
  • wt_wiki_page_parse()
  • wt_wiki_url_build()
  • wt_wiki_url_parse()
  • wt_wikispecies_parse()
  • wt_wikicommons_parse()
  • wt_wikipedia_parse()

High level API

The high level API is meant to be easier and faster to use.

  • wt_data()
  • wt_data_id()
  • wt_wikispecies()
  • wt_wikicommons()
  • wt_wikipedia()

Search functions:

  • wt_wikicommons_search()
  • wt_wikispecies_search()
  • wt_wikipedia_search()

Installation

CRAN version

install.packages("wikitaxa")

Dev version

remotes::install_github("ropensci/wikitaxa")
library("wikitaxa")

wiki data

z <- wt_data("Poa annua")
names(z)
#> [1] "labels"       "descriptions" "aliases"      "sitelinks"    "claims"
head(z$labels)
#>   language            value
#> 1       pt        Poa annua
#> 2       is   Varpasveifgras
#> 3       pl Wiechlina roczna
#> 4       fr   Pâturin annuel
#> 5       es        Poa annua
#> 6       en        Poa annua

Get a Wikidata ID

wt_data_id("Mimulus foliatus")
#> [1] "Q6495130"
#> attr(,"class")
#> [1] "wiki_id"

wikipedia

lower level

pg <- wt_wiki_page("https://en.wikipedia.org/wiki/Malus_domestica")
res <- wt_wiki_page_parse(pg)
res$iwlinks
#> [1] "https://commons.wikimedia.org/wiki/Category:Apples"         
#> [2] "https://commons.wikimedia.org/wiki/Category:Apple_cultivars"
#> [3] "https://www.wikidata.org/wiki/Q158657"                      
#> [4] "https://www.wikidata.org/wiki/Q18674606"                    
#> [5] "https://species.wikimedia.org/wiki/Malus_pumila"            
#> [6] "https://species.wikimedia.org/wiki/Malus_domestica"

higher level

res <- wt_wikipedia("Malus domestica")
res$common_names
#> # A tibble: 1 x 2
#>   name  language
#>   <chr> <chr>   
#> 1 Apple en
res$classification
#> # A tibble: 3 x 2
#>   rank       name             
#>   <chr>      <chr>            
#> 1 plainlinks ""               
#> 2 binomial   "Malus domestica"
#> 3 <NA>       ""

choose a wikipedia language

# French
wt_wikipedia(name = "Malus domestica", wiki = "fr")
#> $langlinks
#> # A tibble: 60 x 5
#>    lang   url                                   langname   autonym    `*`       
#>    <chr>  <chr>                                 <chr>      <chr>      <chr>     
#>  1 als    https://als.wikipedia.org/wiki/Kultu… Alemannis… Alemannis… Kulturapf…
#>  2 am     https://am.wikipedia.org/wiki/%E1%89… amharique  አማርኛ       ቱፋሕ       
#>  3 ast    https://ast.wikipedia.org/wiki/Malus… asturien   asturianu  Malus dom…
#>  4 az     https://az.wikipedia.org/wiki/M%C9%9… azéri      azərbayca… Mədəni al…
#>  5 bat-s… https://bat-smg.wikipedia.org/wiki/V… Samogitian žemaitėška Vuobelės  
#>  6 bg     https://bg.wikipedia.org/wiki/%D0%94… bulgare    български  Домашна я…
#>  7 bpy    https://bpy.wikipedia.org/wiki/%E0%A… bishnupri… বিষ্ণুপ্র…    আপেল      
#>  8 ca     https://ca.wikipedia.org/wiki/Pomera… catalan    català     Pomera co…
#>  9 cs     https://cs.wikipedia.org/wiki/Jablo%… tchèque    čeština    Jabloň do…
#> 10 csb    https://csb.wikipedia.org/wiki/Dom%C… kachoube   kaszëbsczi Domôcô ja…
#> # … with 50 more rows
#> 
#> $externallinks
#>  [1] "http://www.cabi-publishing.org/pdf/Books/0851995926/0851995926_Chap01.pdf"                 
#>  [2] "http://www.umass.edu/fruitadvisor/fruitnotes/ontheorigin.pdf"                              
#>  [3] "http://www.applegenome.org"                                                                
#>  [4] "http://societeradio-canada.info/emissions/les_annees_lumiere/2010-2011/"                   
#>  [5] "http://www.nature.com/ng/journal/vaop/ncurrent/full/ng.654.html"                           
#>  [6] "https://gallica.bnf.fr/ark:/12148/bpt6k28582v"                                             
#>  [7] "http://worldcat.org/issn/1471-2229&lang=fr"                                                
#>  [8] "https://www.ncbi.nlm.nih.gov/pubmed/26924309"                                              
#>  [9] "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4770685"                                      
#> [10] "https://dx.doi.org/10.1186%2Fs12870-016-0739-y"                                            
#> [11] "https://doi.org/10.1186/s12870-016-0739-y"                                                 
#> [12] "http://www.hamblenne.be/LISTE_RGF.pdf"                                                     
#> [13] "http://www.arcticapples.com/blog/john/demystifying-arctic-apples#.UaeX-Jzjmw5"             
#> [14] "http://www.cctec.cornell.edu/plants/GENEVA-Apple-Rootstocks-Comparison-Chart-120911.pdf"   
#> [15] "https://commons.wikimedia.org/wiki/Category:Malus_domestica?uselang=fr"                    
#> [16] "http://www.tela-botanica.org/page:eflore"                                                  
#> [17] "http://www.tela-botanica.org/bdtfx-nn-40744"                                               
#> [18] "http://www.cbif.gc.ca/acp/fra/siti/regarder?tsn=516655"                                    
#> [19] "http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=516655"      
#> [20] "http://www.cbif.gc.ca/acp/fra/siti/regarder?tsn=25262"                                     
#> [21] "http://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value=25262"       
#> [22] "http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?lin=s&p=has_linkout&id=3750"       
#> [23] "http://www.ars-grin.gov/"                                                                  
#> [24] "https://npgsweb.ars-grin.gov/gringlobal/taxonomydetail.aspx?104681"                        
#> [25] "https://www.biolib.cz/en/"                                                                 
#> [26] "https://www.biolib.cz/en/taxon/id39552/"                                                   
#> [27] "http://inpn.mnhn.fr/isb/espece/cd_nom/107207"                                              
#> [28] "http://www.bmlisieux.com/normandie/roblet.htm"                                             
#> [29] "http://site.voila.fr/babadubonsai/docum/docmal.html"                                       
#> [30] "http://www.fruitiers.net"                                                                  
#> [31] "http://www.inra.fr/hyppz/CULTURES/3c---003.htm"                                            
#> [32] "http://cat.inist.fr/?aModele=afficheN&cpsidt=15506238"                                     
#> [33] "http://www.omafra.gov.on.ca/french/crops/facts/98-014.htm"                                 
#> [34] "http://www.gardenaction.co.uk/fruit_veg_diary/fruit_veg_mini_project_september_2_apple.asp"
#> 
#> $common_names
#> # A tibble: 1 x 2
#>   name               language
#>   <chr>              <chr>   
#> 1 Pommier domestique fr      
#> 
#> $classification
#> # A tibble: 0 x 0
#> 
#> $synonyms
#> list()
# Slovak
wt_wikipedia(name = "Malus domestica", wiki = "sk")
#> $langlinks
#> # A tibble: 60 x 5
#>    lang   url                               langname        autonym    `*`      
#>    <chr>  <chr>                             <chr>           <chr>      <chr>    
#>  1 als    https://als.wikipedia.org/wiki/K… Alemannisch     Alemannis… Kulturap…
#>  2 am     https://am.wikipedia.org/wiki/%E… amharčina       አማርኛ       ቱፋሕ      
#>  3 ast    https://ast.wikipedia.org/wiki/M… astúrčina       asturianu  Malus do…
#>  4 az     https://az.wikipedia.org/wiki/M%… azerbajdžančina azərbayca… Mədəni a…
#>  5 bat-s… https://bat-smg.wikipedia.org/wi… Samogitian      žemaitėška Vuobelės 
#>  6 bg     https://bg.wikipedia.org/wiki/%D… bulharčina      български  Домашна …
#>  7 bpy    https://bpy.wikipedia.org/wiki/%… bišnuprijskoma… বিষ্ণুপ্র…    আপেল     
#>  8 ca     https://ca.wikipedia.org/wiki/Po… katalánčina     català     Pomera c…
#>  9 cs     https://cs.wikipedia.org/wiki/Ja… čeština         čeština    Jabloň d…
#> 10 csb    https://csb.wikipedia.org/wiki/D… kašubčina       kaszëbsczi Domôcô j…
#> # … with 50 more rows
#> 
#> $externallinks
#> list()
#> 
#> $common_names
#> # A tibble: 1 x 2
#>   name          language
#>   <chr>         <chr>   
#> 1 Jabloň domáca sk      
#> 
#> $classification
#> # A tibble: 0 x 0
#> 
#> $synonyms
#> list()
# Vietnamese
wt_wikipedia(name = "Malus domestica", wiki = "vi")
#> $langlinks
#> # A tibble: 60 x 5
#>    lang     url                                 langname    autonym   `*`       
#>    <chr>    <chr>                               <chr>       <chr>     <chr>     
#>  1 als      https://als.wikipedia.org/wiki/Kul… Alemannisch Alemanni… Kulturapf…
#>  2 am       https://am.wikipedia.org/wiki/%E1%… Tiếng Amha… አማርኛ      ቱፋሕ       
#>  3 ast      https://ast.wikipedia.org/wiki/Mal… Tiếng Astu… asturianu Malus dom…
#>  4 az       https://az.wikipedia.org/wiki/M%C9… Tiếng Azer… azərbayc… Mədəni al…
#>  5 zh-min-… https://zh-min-nan.wikipedia.org/w… Chinese (M… Bân-lâm-… Phōng-kó-…
#>  6 bg       https://bg.wikipedia.org/wiki/%D0%… Tiếng Bulg… български Домашна я…
#>  7 ca       https://ca.wikipedia.org/wiki/Pome… Tiếng Cata… català    Pomera co…
#>  8 cs       https://cs.wikipedia.org/wiki/Jabl… Tiếng Séc   čeština   Jabloň do…
#>  9 da       https://da.wikipedia.org/wiki/Almi… Tiếng Đan … dansk     Almindeli…
#> 10 de       https://de.wikipedia.org/wiki/Kult… Tiếng Đức   Deutsch   Kulturapf…
#> # … with 50 more rows
#> 
#> $externallinks
#>  [1] "http://biology.umaine.edu/Amelanchier/Rosaceae_2007.pdf"