Premium Project

A Text Analysis of Trump's Tweets

Apply text mining to Donald Trump's tweets to confirm if he writes the (angrier) Android half.

Start Project
  • 12 tasks
  • 819 participants
  • 1,500 XP

Project Description

This tweet containing a hypothesis about Donald Trump's Twitter account needs to be investigated with data:

Every non-hyperbolic tweet is from iPhone (his staff).

Every hyperbolic tweet is from Android (from him). pic.twitter.com/GWr6D8h5ed

— Todd Vaziri (@tvaziri) August 6, 2016

Others have explored Trump’s timeline and noticed this tends to hold up. And Trump himself did indeed tweet from a Samsung Galaxy until March 2017. But how could it be examined quantitatively? In this project, you will apply text mining and sentiment analysis to determine whether or not Trump does indeed write the angrier, Android tweets.

This project lets you apply the skills from Introduction to the Tidyverse, Data Visualization with ggplot2 (Part 2), String Manipulation in R with stringr, and Sentiment Analysis in R: The Tidy Way. We recommend that you take those course before starting this project.

The dataset used in this project is from The Trump Twitter Archive by Brendan Brown, which contains all 35,000+ tweets from the @realDonaldTrump Twitter account from 2009 (the year Trump sent his first tweet) through 2018.

Project Tasks

  • 1The tweets
  • 2Clean those tweets
  • 3Is "time" the giveaway?
  • 4The quote tweet is dead
  • 5Links and pictures
  • 6Comparison of words
  • 7Most common words
  • 8Common words: Android vs. iPhone (i)
  • 9Common words: Android vs. iPhone (ii)
  • 10Adding sentiments
  • 11Android vs. iPhone sentiments
  • 12Conclusion: The ghost in the political machine
Instructor Avatar
David Robinson

Chief Data Scientist, DataCamp

Dave works on the data science behind DataCamp's product and curriculum development. He has worked as a data scientist at Stack Overflow and received his PhD in Quantitative and Computational Biology from Princeton University. His interests include statistics, data analysis, education, and programming in R. Follow him at @drob on Twitter or on his blog, Variance Explained.

See More

Technology

  • R LogoR
  • Topics

    Data ManipulationData VisualizationProbability & StatisticsImporting & Cleaning Data