Wikipedia Article Traffic Comparison - Shiny App

Dror A. Guldin
September 26th, 2015

Main Concept

This Shiny app (available at: http://d50stuck.Shinyapps.io/project) enables the user to compare the traffic of two english Wikipedia articles, for a period of 1-3 months.

It is useful for comparing patterns and anomalies regarding information-seeking of two related articles.

For Example, the default example is comparing the number of entries for articles of two of the prominant republican candidates in the current primaries (Marco Rubio and Jeb Bush).

How Does It Work?

The app takes as input (from the user interface) two things:

  • Length of period for comparison (either 30, 60, or 90 days)
  • Names of two english Wikipedia articled

It then (on the server side) retrieves the relevant data from http://stats.grok.se/ and creates a visualization of it using the ggplot2 library and calculates the average of daily traffic for each of the articles.

To save time, the data is not retrieved while changing the articles' names, until the “Compare!” button is pushed (switching period length AUTOMATICALLY renders new plot and calculations).

How Is The Data Retrieved?

Since the stats.grok.se site has a consistent hierarchy for all relevant JSON files, the Shiny app retrieves data using the following manipulation:

page<-c(input$article1, input$article2)

for (i in 1:2){
getURL(paste("http://stats.grok.se/json/en/latest", input$numofdays, "/", page[i], sep=""))
}

Where article1 and article2 are the names of the Wikipedia articles entered by the user, and numofdays are the period length chosen (either 30, 60, or 90 - the optional hierarchies available at stats.grok.se).

Example Of Traffic Comparison Plot

This is an example of the default plot rendered with the app, comparing the traffic to the Wikipedia articles regarding Marco Rubio (black line) and Jeb Bush (red line).

This plot is now evaluated on this presentation, by imitating the app's conduct:

plot of chunk unnamed-chunk-2