LoslegenKostenlos loslegen

Search and extract tweets

Many functions are available in R to extract twitter data for analysis.

search_tweets() is a powerful function from rtweet which is used to extract tweets based on a search query.

The function returns a maximum of 18,000 tweets for each request posted.

In this exercise, you will use search_tweets() to extract tweets on the Emmy Awards which are American awards that recognize excellence in the television industry, by looking for tweets containing the Emmy Awards hashtag.

The library rtweet has been pre-loaded for this exercise.

Diese Übung ist Teil des Kurses

Analyzing Social Media Data in R

Kurs anzeigen

Anleitung zur Übung

  • Extract 2000 tweets on "#Emmyawards", including all retweets.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Extract tweets on "#Emmyawards" and include retweets
twts_emmy <- ___("___", 
                 n = ___, 
                 include_rts = ___, 
                 lang = "en")

# View output for the first 5 columns and 10 rows
head(twts_emmy[,1:5], 10)
Code bearbeiten und ausführen