This lab will give you practice with

  • web scraping with the rvest package
  • twitter’s API with the rtweet package
library(rvest)
library(stringr)

The lab is due:

Q1: scrape NYT homepage

Use the rvest package to get a list of all the story titles appearing on the NTY homepage: https://www.nytimes.com/.

# some code to get articles titles
article_titles <-
    
# print out the first 10 titles so the grader can tell your code ran
article_titles[1:10]

Q2: scrape Hadley Wickham’s twitter

Use the rtweet package to scrape twitter and answer the following question. How many of Hadley Wickham’s most recent 100 tweets mention the word data (his twitter handle is @hadleywickham).