Retrieving text from the web

There are numerous ways to retrieve text from the web. The previous section used the Hypertext Transfer Protocol (HTTP) through the httr package to retrieve text from the web. A combination of substr() and regexpr() was then used to extract only a small piece of information from it.

This section will show you how to retrieve text from the web using two different packages:

  • rvest: This can easily perform common web scrapping tasks
  • rtweet: It works with Twitter's web API to gather data

There are numerous ways to use data gathered this way. To name a few, it could be used to develop stock trading, marketing strategies, train chatbots, run sentiment analysis, seeks candidates for a job, or phrase click baits. Our ...

Get Hands-On Data Science with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.