Learn R Programming

WikipediaR (version 1.1)

backLinks: lists pages that link to the Wikipedia page

Description

lists all pages that link to a specific Wikipedia page.

Usage

backLinks(page = NULL, domain = "en")

Arguments

page
numeric identifier or character title of the specific wikipedia page
domain
a character value specifying the language of the wikipedia page.The default value is "en" for "english language".

Value

an object of class backLinksClass containing:
  • call the command line
  • page title, identification number and domain of the Wikipedia page, created only if the page exists.
  • backLinks a data frame containing title, the titles of the pages that link to the specific page, pageid, the pages IDs, ns, numbers of the namespaces (identification of the type of pages, defining nscat et nssubj, the two next variables), nscat, the categories of linked pages (Subject, Talk, or Virtual), nssubj, the subjects of the linked pages (Main Article, User, Wikipedia, File, MediaWiki, Template, Help, Category, Protal, Book, Draft, Education Program, TimedText, Module, Topic, Special, Media, Other). For more details about namespace, see http://en.wikipedia.org/wiki/Wikipedia:Namespace#Subject_namespaces If the page has no back link or does not exist, this item is not created.
  • testWikiPage a list of four elements,
    • takeOnlyFirst a boolean indicating if the class of page parameter is invalid, for example vector, list, matrix..., and in that case, only the first element is considered.
    • redirPage title of the redirected page. This item is NULL if the page is not redirected.
    • test an integer with value:
      • 4 for invalid domain,
      • 3 for an empty parameter page,
      • 2 when Wikipedia does not have an article with this exact name,
      • 1 for ambiguous page, direct or redirect,
      • 0 for valid an unambiguous page, direct or redirect.
    • warnMessage is a vector of warning messages.

Details

This function uses API query syntax: "list=backlinks". For more details, see https://www.mediawiki.org/wiki/API:Backlinks

See Also

print.backLinksClass links

Examples

Run this code
## Not run: 
# #' # a simple example
# backLinks("Louis Pasteur") 
# 
# backLinks.Baschet <- backLinks(page ="Cristal Baschet", domain ="fr")
# table(backLinks.Baschet$backLinks$nscat)
# 
# ## example with no back link
# backLinks(page = 976, domain = "en" )
# 
# # with a page that not exist (at the moment of the redaction of this help page)
# backLinks("zzzzz")
# ## End(Not run)

Run the code above in your browser using DataLab