wt_wikicommons {wikitaxa}R Documentation

WikiCommons

Description

WikiCommons

Usage

wt_wikicommons(name, utf8 = TRUE, ...)

wt_wikicommons_parse(page, types = c("langlinks", "iwlinks", "externallinks",
  "common_names", "classification"), tidy = FALSE)

wt_wikicommons_search(query, limit = 10, offset = 0, utf8 = TRUE, ...)

Arguments

name

(character) Wiki name - as a page title, must be length 1

utf8

(logical) If 'TRUE', encodes most (but not all) non-ASCII characters as UTF-8 instead of replacing them with hexadecimal escape sequences. Default: 'TRUE'

...

curl options, passed on to [httr::GET()]

page

([httr::response()]) Result of [wt_wiki_page()]

types

(character) List of properties to parse

tidy

(logical). tidy output to data.frame's if possible. Default: 'FALSE'

query

(character) query terms

limit

(integer) number of results to return. Default: 10

offset

(integer) record to start at. Default: 0

Value

wt_wikicommons returns a list, with slots:

wt_wikicommons_parse returns a list

wt_wikicommons_search returns a list with slots for continue and query, where query holds the results, with query$search slot with the search results

References

https://www.mediawiki.org/wiki/API:Search for help on search

Examples

## Not run: 
# high level
wt_wikicommons(name = "Malus domestica")
wt_wikicommons(name = "Pinus contorta")
wt_wikicommons(name = "Ursus americanus")
wt_wikicommons(name = "Balaenoptera musculus")

wt_wikicommons(name = "Category:Poeae")
wt_wikicommons(name = "Category:Pinaceae")

# low level
pg <- wt_wiki_page("https://commons.wikimedia.org/wiki/Malus_domestica")
wt_wikicommons_parse(pg)

# search wikicommons
wt_wikicommons_search(query = "Pinus")

## use search results to dig into pages
res <- wt_wikicommons_search(query = "Pinus")
lapply(res$query$search$title[1:3], wt_wikicommons)

## End(Not run)

[Package wikitaxa version 0.2.0 Index]