Fetching the number of tweets

Depending on how many tweets you wish for, it could take many days and hours to get it. The query we are about to conduct may take only a few minutes. Using the beepr package, it's possible to trigger an alarm once the query is complete:

if(!require(beepr)){install.packages('beepr')}library(beepr)

Given point number three, you might not be able to reproduce the results that I got myself. Yet, I encourage you to try the codes and compare the results; that's a great way to get some practice. Let's get started with search_tweets2():

tweets_dt <- search_tweets2(q = '#rstats',                             n = 20000,                             include_rts = T,                            tweet_mode = 'extended',                            retryonratelimit = T,                            token = my_token)for(i in 0:2){beep(5); Sys.sleep(3)}

The previous ...

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.