get_diff {wikkitidy}R Documentation

Search for insertions, deletions or relocations of text between two versions of a Wikipedia page

Description

Any two revisions of a Wikipedia page can be compared using the 'diff' tool. The tool compares the 'from' revision to the 'to' revision, looking for insertions, deletions or relocations of text. This operation can be performed in any order, across any span of revisions.

Usage

get_diff(from, to, language = "en", simplify = TRUE)

Arguments

from

Vector of revision ids

to

Vector of revision ids

language

Vector of two-letter language codes (will be recycled if length==1)

simplify

logical: should R simplify the result (see return)

Value

The return value depends on the simplify parameter.

Examples

# Compare revision 847170467 to 851733941 on English Wikipedia
get_diff(847170467, 851733941)

# The function is vectorised, so you can compare multiple pairs of revisions
# in a single call
# See diffs for the last two revisions of the Main Page
revisions <- wiki_action_request() %>%
  query_by_title("Main Page") %>%
  query_page_properties(
    "revisions",
    rvlimit = 2, rvprop = "ids", rvdir = "older"
  ) %>%
  next_result() %>%
  tidyr::unnest(cols = c(revisions)) %>%
  dplyr::mutate(diffs = get_diff(from = parentid, to = revid))
revisions

[Package wikkitidy version 0.1.12 Index]