WikipediR (version 1.5.0)

categories_in_page: Retrieves categories associated with a page.

Description

Retrieves categories associated with a page (or list of pages) on a MediaWiki instance

Usage

categories_in_page(language = NULL, project = NULL, domain = NULL, pages,
  properties = c("sortkey", "timestamp", "hidden"), limit = 50,
  show_hidden = FALSE, clean_response = FALSE, ...)

Arguments

language

The language code of the project you wish to query, if appropriate.

project

The project you wish to query ("wikiquote"), if appropriate. Should be provided in conjunction with language.

domain

as an alternative to a language and project combination, you can also provide a domain ("rationalwiki.org") to the URL constructor, allowing for the querying of non-Wikimedia MediaWiki instances.

pages

A vector of page titles, with or without spaces, that you want to retrieve categories for.

properties

The properties you want to retrieve about the categories. Options are "sortkey" (the key that sorts the way the page is stored in each category), "timestamp" (when the category was added to that page) and "hidden" (tags those categories in the returned list that are 'hidden' from readers).

limit

The maximum number of categories you want to retrieve for each page. Set to 50 by default.

show_hidden

Whether or not to include 'hidden' categories in the categories that are retrieved - these are usually associated with the maintenance of Wikipedia and its internal processes. Set to FALSE by default.

clean_response

whether to do some basic sanitising of the resulting data structure. Set to FALSE by default.

...

further arguments to pass to httr's GET.

See Also

pages_in_category for pages in a specified category.

Examples

Run this code

#Retrieve the categories for the "New Age" article on en.wiki
cats <- categories_in_page("en", "wikipedia", pages = "New Age")

#Retrieve the categories for the "New Age" article on rationalwiki.
rw_cats <- categories_in_page(domain = "rationalwiki.org", pages = "New Age")

Run the code above in your browser using DataLab