As part of this weeks #MakeoverMonday series, Tableau zen Andy Kriebel, and his partner in crime Eva Murray posted a data set which listed a series of tweets with which president Donald Trump has either tweeted himself, or retweeted, over the last 6 years, during his run up to taking the White House hot seat.
Immediately I saw 3 ways of analysing this data.
- Time series analysis
- Text analysis
- Time series and text analysis
The notion of text analytics is something I, and most of us, find fascinating, but it is notoriously difficult to get real insight from.
In the visualisation I created below I went for something quite simple. I looked to analyse hashtags used within those tweets.
In this post I will show you, how in two Alteryx tools, and one Regex formula I managed to create a list of all hashtags used within the data.
- Input your data (obviously), the data used in this project can be found here.
- Use a regex tool to tokenize and parse the text column, by looking for hashtags and from this point taking anything between the hashtag and the next space.#[[:alnum:]]+# = look for hashtag
[[:alnum:]] = look for alphanumeric characters
+ = look for any number of consecutive alphanumeric characters
You will also note that I used the split to rows tool. This is because a tweet can contain any number of hashtags. If we wished to have a row per tweet we can always bring out data back into that structure using the crosstab tool.
We can now run the workflow and…
There was some further data preparation needed to get the data into the correct shape to build the visualisation above and the finished workflow can be found here.