
Explore Twitter sentiment analysis using R and Tableau to harvest, clean, analyze, and visualize tweets with dashboards, maps, and time-based trends, using a simple English lexicon.
Apply text mining and lexicon-based sentiment analysis using R and Tableau. Harvest Twitter data across New York, Los Angeles, Toronto, and London to compare Samsung Galaxy and Apple iPhone sentiment.
Learn how to set up a Twitter developer account, obtain consumer key and secret and access tokens, and connect to the Twitter API for text data analysis in R.
Learn to install and manage the essential packages for text mining and sentiment analysis in R, including Twitter API authentication and tweet harvesting.
Connect Twitter to R by configuring consumer keys, secrets, and tokens through the setup Twitter auth workflow. Verify strings and store connection info before testing tweet search.
Learn to harvest tweets with the search Twitter function, configure API access, and navigate 14-day history and 15-minute limits while tuning language, geolocation, and result types.
Explore extracting tweet text and metadata from the status class using the Twitter package. Learn to access fields like created, retweeted count, user details, and date formatting for sentiment analysis.
Apply phase i tweet cleaning to prepare Twitter data for sentiment analysis by converting text encoding, removing symbols, digits, punctuation, and unwanted patterns with regex.
Explore how a sentiment lexicon powers analysis by matching English positive and negative word lists to score sentiment, while importing the Ulu Library with read_lines.
Learn to implement a lexicon-based sentiment score function in R that counts positive and negative hits in tweets, using text cleaning, lowercasing, tokenization, and lapply-based processing.
Organize harvested tweet data into a data frame, bind text, date, retweet status, retweet and favorite counts, product, city, country, and duplicates, then export as CSV for Tableau analysis.
Lexicon-based sentiment analysis offers simplicity for non-experts, but struggles with negation, sarcasm, cynicism and questions; it relies on cleaning and lexicons, with language and domain limitations.
Execute an end-to-end R workflow to harvest tweets, clean text, and apply sentiment scoring with lexicons, then assemble results into a data frame for export.
Connect seven text files with identical columns using a union in Tableau, verify fields and data types, and fix product name with a calculated field for clean analysis.
Explore the ratio of original and duplicate tweets using Tableau, confirm how duplicates affect sentiment analysis, and fix labeling with a calculated field to distinguish originals from duplicates.
Explore how retweets and duplicates inflate the tweet count in a dataset, interpret the duplicate field, and analyze original versus duplicate texts across cities and products.
Inspect the data set's time span by visualizing tweet frequency over time, noting city and product effects and Apple events using Tableau.
Explore text mining techniques to classify tweets by product mentions using Tableau, including lowercasing text, creating calculated fields, and using contains and if statements to distinguish iPhone, Samsung, or both.
Visualize tweet sentiment scores by converting them to polarity categories and building bar charts and tree maps. Use a polarity switch to include or exclude neutrals and compare data subsets.
Visualize city-level tweet polarity by product with Tableau, using fixed city-level calculations to compute percent neutral, positive, and negative, and compare Apple and Samsung via color-coded circles.
Plot geo data on maps in Tableau, using city names or coordinates, switch between symbol and field maps, and create level-of-detail calculations to show polarity and tweet counts across cities.
Switch between exchangeable charts, a map, and a tree map, in a dashboard using a parameter and a calculated field to save space and improve clarity.
Extract key insights by designing concise dashboards that prioritize essential graphs, use coherent color schemes, and apply thoughtful filters and actions to create interactive storytelling with Tableau.
Explain the full workflow of text mining and sentiment analysis with Twitter data, from connection and scraping to cleaning, sentiment scoring, and Tableau visualizations across four cities.
Explore strings as text data in R, learning how to define, manipulate, and split them with base functions like tolower, toupper, and strsplit, while handling encoding differences and regular expressions.
Explore the gsub and sub functions in R, learning pattern matching, replacement, and string manipulation with regular expressions, including case sensitivity, ignore-case options, digit and space handling.
Explore regular expressions syntax in R, including digit and non-digit matches, whitespace and word classes, character sets, quantifiers, and practical examples of removing punctuation.
Explore how to use the stringer package to manipulate strings with functions like string concatenate, count, locate all, and replace and replace all.
Practice regular expressions and the global substitute in R by completing a string-cleaning exercise that lowers case, removes punctuation and spaces, removes the euro sign, and applies stringr's extract_all.
Extract valuable info out of Twitter for marketing, finance, academic or professional research and much more.
This course harnesses the upside of R and Tableau to do sentiment analysis on Twitter data. With sentiment analysis you find out if the crowd has a rather positive or negative opinion towards a given search term. This search term can be a product (like in the course) but it can also be a person, region, company or basically anything as long as it is mentioned regularly on Twitter.
While R can directly fetch the text data from Twitter, clean and analyze it, Tableau is great at visualizing the data. And that is the power of the method outlined in this course. You get the best of both worlds, a dream team.
Content overview and course structure:
The R Side
Getting a Twitter developers account
Connection of Twitter and R
Getting the right packages for our approach
Harvesting Tweets and loading them into R
Refining the harvesting approach by language, time, user or geolocation
Handling Twitter meta data like: favorites, retweets, timelines, users, etc
Text cleaning
Sentiment scoring via a simple lexicon approach (in English)
Data export (csv) for further Tableau work
Tableau Side:
Data preparation for visualizations
Quick data exploration
Dashboards
Visualizing -
You only need basic R skills to follow along. There is a free version of Tableau called Tableau public desktop, or even better: as a full time college student you can get a free but full version of Tableau desktop professional.
The course comes with the R code to copy into your R session.
Disclaimer required by Twitter: 'TWITTER, TWEET, RETWEET and the Twitter logo are trademarks of Twitter, Inc or its affiliates.'