knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
options("gu.API.key" = "test")

guardianapi

License: MIT CRAN status GitHub tag AppVeyor build status R build status Coverage status DOI

Access to the Guardian open API https://open-platform.theguardian.com/, containing all articles published in the Guardian from 1999 to the present. An API key is required, sign up here.

Installation

guardianapi is available on CRAN:

install.packages("guardianapi")

You can install the development version guardianapi from github with:

# install.packages("devtools")
devtools::install_github("evanodell/guardianapi")

Usage

Save your API key as the environmental variable GU_API_KEY, or use the gu_api_key() function to set a key for a single session.

guardianapi contains functions to query and retrieve articles, tags, editions and sections. For example, return all tags containing the string "apple", which includes both the technology company and Fiona Apple, amongst others.

library(guardianapi)

tags1 <- gu_tags(query = "apple")

tibble::glimpse(tags1)

Return all articles with the string "relationships" and the tag "lifeandstyle/sex" from December 2018:

relations_sex <- gu_content(query = "relationships", from_date = "2018-12-01",
                            to_date = "2018-12-31", tag = "lifeandstyle/sex")

tibble::glimpse(relations_sex)

See the full package documentation at docs.evanodell.com/guardianapi.

Meta

Please note that the 'guardianapi' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

This package is not affiliated with or supported by The Guardian.



evanodell/guardianapi documentation built on Nov. 27, 2020, 9:13 a.m.