Filter based on tweet popularity
Popular tweets are tweets that are retweeted and favorited several times.
They are useful in identifying current trends. A brand can promote its merchandise and build brand loyalty by identifying popular tweets and retweeting them.
In this exercise, you will extract tweets on "Chelsea"
that have been retweeted a minimum of 100 times and also favorited at least by 100 users.
The library rtweet
has been pre-loaded for this exercise.
This exercise is part of the course
Analyzing Social Media Data in R
Exercise instructions
- Extract tweets with a minimum of 100 retweets and 100 favorites using filters.
- Create a data frame with the retweet and favorite counts.
- View the tweets.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Extract tweets with a minimum of 100 retweets and 100 favorites
tweets_pop <- search_tweets("Chelsea ___:___ AND ___:___")
# Create a data frame to check retweet and favorite counts
counts <- tweets_pop[c("___", "favorite_count")]
head(counts)
# View the tweets
head(tweets_pop$text)