wp_trend: Function for getting access statistics for wikipedia pages

Description Usage Arguments Examples

View source: R/wp_trend.R

Description

Function for getting access statistics for wikipedia pages

Usage

1
2
wp_trend(page = "Peter_principle", from = Sys.Date() - 30,
  to = Sys.Date(), lang = "en", friendly = F, requestFrom = "anonymous")

Arguments

page

The name of the Wikipedia page as to be found in the URL to the wikipedia article. If e.g. the URL is: https://en.wikipedia.org/wiki/Peter_Fox_(musician), than the page name equals to Peter_Fox_(musician).

from

The starting date of the timespan for which access statistics should be retrieved - note that there is no data prior to 2007-12-01. Supply some sort of timestamp e.g. of class POSIXlt, POSIXct, Date, or character. If the option is of type character it should be in the form of yyyy-mm-dd.

to

The last date for which access statistics should be retrieved. Supply some sort of timestamp e.g. of class POSIXlt, POSIXct, Date, or character. If the option is of type character it should be in the form of yyyy-mm-dd.

lang

The language shorthand identifying which Wikipedia access statistics are to be used: e.g. "en" for the English version found at http://en.wikipedia.org, "de" for the German version found at http://de.wikipedia.org or perhaps "als" for the Alemannic dialect found under http://als.wikipedia.org/.

friendly

Either TRUE, FALSE, 1 or 2 This option causes twofold. First, if the value is set to TRUE, 1, or 2 the results of the request are saved in the current working directory in a CSV file with name scheme: wp__[page name]_[country code].csv. Second, the function will look if perhaps a previously saved result is available to be used to only download those information that are still missing instead of the whole timespan.

For storage on disk write.csv() (friendly=TRUE or friendly=1) and write.csv2() (friendly=2) are used.

requestFrom

This parameter sends an identifier (i.e. your email address to contact you if necessary) to stats.grok.se (the server that kindly provides the information you request).

Examples

1
2
3
4
5
6
wp_trend(page="Main_Page",
         from="2014-11-01",
         to="2014-11-30",
         lang="en",
         friendly=FALSE,
         requestFrom="R package wikipedia trend test request")

johndharrison/wikipediatrend documentation built on May 19, 2019, 5:14 p.m.