Learn R Programming

pageviews (version 0.6.0)

top_articles: Retrieve Data on Top Articles

Description

top_articles grabs data on the top articles for a project in a given time period, and for a particular platform.

Usage

top_articles(
  project = "en.wikipedia",
  platform = "all",
  start = as.Date("2015-10-01"),
  granularity = "daily",
  reformat = TRUE,
  ...
)

Arguments

project

the name of the project, structured as [language_code].[project] (see the default).

platform

The platform the pageviews came from; one or more of "all", "desktop", "mobile-web" and "mobile-app". Set to "all" by default.

start

The date the articles were "top" in. 2015 by default.

granularity

the granularity of data to return; "daily" or "monthly", depending on whether top articles should reflect trends in day or month of the start date.

reformat

Whether to reformat the results as a data.frame or not. TRUE by default.

...

further arguments to pass to httr's GET.

See Also

article_pageviews for per-article pageviews and project_pageviews for per-project pageviews.

Examples

Run this code
# Basic example
enwiki_top_articles <- top_articles()

# Use a narrower platform
enwiki_mobile_top <- top_articles(platform = "mobile-web")

Run the code above in your browser using DataLab