Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

There’s rightly been a lot of attention paid to USA President Trump’s first speech as President at the time of his inauguration. The speech broke with tradition by extending the acrimonious atmosphere of the election campaign into the Presidency. There’s been an instant flurry of analysis, with the Washington Post leading the way with this analysis of words that have not been used in any prior US presidential inauguration speeches. All this, and the sense of major things going on in the world, prompted me to see what I could find myself in the historical speeches and President Trump’s latest addition.

I got the historical texts from the quanteda R package, which includes the inauguration speeches up to 2013 as an example dataset. There are plenty of human-readable alternatives such as this one from the Yale Law School. I grabbed the transcript of Trump’s speech directly from the web and just pasted it into a text document.

I ended up with three main pieces of exploratory analysis:

• Tracking three key words over time
• Unique words
• Distinctive words

## Key words over time

I took four words that have particular resonances in US politics: freedom, democracy, protection and America.

“America” featured very prominently in Trump’s address, including the revival of a 1940s “America First” slogan that was aimed at keeping the USA out of the European war against Nazism; but I didn’t realise how prominently “America” was until I’d counted the words. Used 35 times out of 1,455 words, fully one word in 40 of Trump’s was “America” or a variant. But while this was a record, it wasn’t out of the league of precedent; Bill Clinton, George W. Bush and Richard Nixon all had more than 1% of their words as “America” or variant.

As the chart below shows, Trump’s use of “protect” and “protection” was more unusual and distinctive. With uncomfortable economic connotations since being blamed for the 1930s Great Depression, and with additional negative connotations for some of a paternalist state, “protectionism” and its variants were barely mentioned in inauguration speeches in the century before Trump. One has to go back to the speech of President Polk in 1845 to find comparable usage. Protectionism was a hot topic in 1845, with the pro free-trade agricultural interests paticularly in the south challenged by infant industries, particularly in the northern states, and within twenty years it was an important contributing cause of the Civil War. Polk managed to walk a thin and dangerous line between the two camps, and reading his inauguration speech it is interesting to see the multiple uses he puts the word “protect” to before bringing up the matter of tariffs.

Of my remaining two words, President Trump made no reference to “democracy” and little to “free”.

It’s interesting to see the historical ebb and flow in all these words, reflected in the four-yearly ritual of inaugurating a new president. Discussion of “democracy” peaked under Roosevelt during the war with Germany and Japan, and had a revival at the end of the twentieth century in the period between the Cold War and the “War on Terror”. “Free” as a word was most popular in Cold War speeches, with a second spike in George W. Bush’s 2005 inauguration.

## Unique words

The Washington Post analysis already referred to gave considerable emphasis to the unique words in President Trump’s speech. This prompted me to have a look at the first-term speeches of all of the last four Presidents, visualised in the graphic below:

The stark imagery and agressive language and delivery of Trump’s speech was confronting listening or reading: first use of the words sad, disrepair, bleed, ripped, stealing, windswept, depletion and of course “American carnage” which will most likely become the most remembered phrase from the speech. We see that President Obama’s first address in 2009 also introduced many words including icy, specter, sweatshops, stale, tanks, grudgingly, greed and grievance, but the humble wordclouds fail to communicate the difference in tone between President Trump and all three of his predecessors. Overall, I’m not too pleased with this particular “first use of word” analysis as giving much in the way of insight.

## Distinctive words

Combining the two streams of analysis above, I wanted to do something a little more sophisticated than simply identifying the unique words used by particular Presidents. In the graphic below I go the next step and identify words which are most distinctive to a particular Presidential address. These are words that might be used elsewhere, but are most characteristic of a particular speech. The size and colour of the words below are mapped to the “tf-idf” ie “term frequency – inverse document frequency” statistic, which compares the frequency of each word in a speech with how often it is used by other documents in the corpus (in this case, other speeches).

Interested readers might prefer to access this as a PDF, allowing you to linger over individual wordclouds. Overall, I’m much happier with this as a piece of exploratory analysis, and in fact it gives a surprisingly compelling snapshot of a slice of US history. Some interesting snippets:

• Madison’s 1813 inauguration understandably made considerable mention of the 1812 war with Britain, part of the great global confrontation of the Napoleonic wars which led to both Moscow and Washington in flames, with prominence in the speech given to “british”, “massacre”, “cruel”, “savage”, “prisoners” and “captives”
• While we’ve seen Polk in 1845 made extensive mention of protectionism and its variants, in the graphic above we see that the really distinctive element of his speech was the discussion of Texas, which at that time was seeking annexation to the USA in the face of opposition from Mexico and from southern US states.
• McKinley’s inauguration in 1901 shortly after the Spanish – USA war contains considerable mention of Cuba and the Philippines
• Hoover’s 1929 speech included discussion of the 18th amendment to the Constitution, on prohibition of alcohol
• As we’ve already seen, democracy is prominent in several of F.D.R Roosevelt’s speeches
• Truman’s 1949 speech, to a post-War world entering both the Cold War and a period of unprecedented prosperity and growth, introduced both “communism” and the technocratic term “program”, as well as terms such as “technical”, “scientific”, “regime”, “economic” and “countries”.

Plenty of other snippets of interesting detail hinted at too. In fact, I do recommend browsing through the full texts of these interesting and often powerful historical documents. No bag of words analysis like this will give you “the better angels of our nature” (Lincoln 1861), “the only thing we have to fear is fear itself” (Roosevelt 1933) and “ask not what your country can do for you; ask what you can do for your country” (Kennedy 1961).

## Code

The code to produce all this in R depends heavily on Julia Silge and David Robinson’s tidytext package and the philosophy set out in their Tidy Text Mining book.