knitr::opts_chunk$set(
  eval = FALSE,
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%",
  eval = FALSE
)
options(width = 110)
library(nyt)

nyt

lifecycle

Collecting nytimes data.

Installation

You can install {nyt} from Github with:

devtools::install_github("mkearney/nyt")

nyt_articles()

This is a basic example showing how to search for articles from the US section:

## basic example code
us1 <- nyt_articles(section = "us", page = 1)

## view data
us1

And here is an example of fetching multiple pages of results from an article search of the world section:

## get multiple pages
w <- purrr::map(1:3, ~ nyt_articles(section = "world", page = .x))

## merge and view data
dplyr::bind_rows(w)

nyt_comments()

This is a basic example showing how to get the user/community comments associated with an article's URL:

## basic example code
c1 <- nyt_comments(us1$url[9])

## view data
c1


mkearney/nyt documentation built on May 23, 2019, 1:07 a.m.