Giter Club home page Giter Club logo

nyt's Introduction

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
#> # A tibble: 10 x 17
#>    first_publishedā€¦ byline tone  add_sort_date       data_type data_id url   created             uri   summary
#>  * <lgl>            <chr>  <chr> <dttm>              <chr>     <chr>   <chr> <dttm>              <chr> <chr>  
#>  1 NA               By MIā€¦ NEWS  2018-08-03 18:22:34 article   100000ā€¦ httpā€¦ 2018-08-03 18:22:34 nyt:ā€¦ The faā€¦
#>  2 NA               By MAā€¦ NEWS  2018-08-03 18:10:40 article   100000ā€¦ httpā€¦ 2018-08-03 18:10:40 nyt:ā€¦ Prosecā€¦
#>  3 NA               By ANā€¦ NEWS  2018-08-03 17:55:06 article   100000ā€¦ httpā€¦ 2018-08-03 17:55:06 nyt:ā€¦ No faiā€¦
#>  4 NA               By JOā€¦ NEWS  2018-08-03 17:18:09 article   100000ā€¦ httpā€¦ 2018-08-03 17:18:09 nyt:ā€¦ Hereā€™sā€¦
#>  5 NA               By CHā€¦ NEWS  2018-08-03 17:11:47 article   100000ā€¦ httpā€¦ 2018-08-03 17:11:47 nyt:ā€¦ The inā€¦
#>  6 NA               By ANā€¦ NEWS  2018-08-03 16:49:01 article   100000ā€¦ httpā€¦ 2018-08-03 16:49:01 nyt:ā€¦ The Unā€¦
#>  7 NA               By JUā€¦ NEWS  2018-08-03 16:36:10 article   100000ā€¦ httpā€¦ 2018-08-03 16:36:10 nyt:ā€¦ A 187-ā€¦
#>  8 NA               By BRā€¦ NEWS  2018-08-03 16:14:27 article   100000ā€¦ httpā€¦ 2018-08-03 16:14:27 nyt:ā€¦ At theā€¦
#>  9 NA               By KAā€¦ NEWS  2018-08-03 15:26:01 article   100000ā€¦ httpā€¦ 2018-08-03 15:26:01 nyt:ā€¦ Their ā€¦
#> 10 NA               By MAā€¦ NEWS  2018-08-03 14:12:29 article   100000ā€¦ httpā€¦ 2018-08-03 14:12:29 nyt:ā€¦ The auā€¦
#> # ... with 7 more variables: snippet <chr>, headline <chr>, print_information <lgl>,
#> #   first_published_iso_timestamp <dttm>, kicker <chr>, publication_date <dttm>, body <chr>

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

nyt's People

Contributors

mkearney avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.