Tag Archives: twitter

Yes, you can search Twitter and block unwanted accounts automatically


Using the link https://twitter.com/search-advanced also advanced search is possible while I run a remote backup with archive page and any local copies using GoFullPage. Also Likers Blocker is recommended.

How to save a Twitter thread

This is not a trivial task as most browser produce garbage when printing to pdf. Also screenshots do not help so much with multipage threads. “Unroll” also doesn’t work reliable.

So I have been using the archive.today plugin before producing the pdf,  but this method is time consuming  as it needs a captcha.

Having now Selenium running in a docker container, there is a more convenient solution where  just two lines of R are sufficient

remDr$screenshot(file = 'screen.png')

Login is also possible as explained at github

username <- remDr$findElement(using = "name", value = "session[username_or_email]")
passwd <- remDr$findElement(using = "name", value = "session[password]")
passwd$sendKeysToElement(list("XXX", "\uE007"))

A sentiment analysis of the most recent @realDonaldTrump tweets

There had been a repeated assessments of psychiatrists during the presidentship of Donald Trump (“The Dangerous Case of Donald Trump: 37 Psychiatrists and Mental Health Experts Assess a President – Updated and Expanded with New Essays“).

I am now analyzing here the 3.200 most recent tweets using a computational pipeline created already some years ago using the following packages

# -- based on https://www.r-bloggers.com/analyzing-the-us-election-using-twitter-and-meta-data-in-r and http://juliasilge.com/blog/Joy-to-the-World/
list.of.packages &lt;- c("twitteR","ggplot2","httr","rjson","tm","gridExtra","lubridate","wordcloud","devtools","syuzhet","SnowballC","scales","reshape2","dplyr","stringr")
lapply(list.of.packages, require, character.only = TRUE)

The choice of words isn’t unexpected – just what is already known – with “great”, “president”, “will” and “trump” being the most frequently used words.


All tweets can be classified by sentiment scores of the words used. If we look at the total counts, three categories are being used excessively: “positive”, “negative” and “trust”.

sentiment scores

Trust seems to be used not so much in the context of personal relationship but in the context of economics  of “deal”. As it has been speculated that he suffers of cyclothymia ( 0.4% to 1% of the U.S. population has cyclothymia) we can look also the time course of sentiments.

time series on a daily basis
time series using 3 day intervals
time series weekly basis

Variation (dispersion) is high, in particular on a daily basis, while in the absence of any normal values it is difficult to make any definite conclusions. Positive and negative emotions are not always in parallel, there are “converging situations” nearly every month where negative emotions go up and positive emotions go down indicating a more profound mood swing.

The correlation plot shows the expected decline of negative scores with increasing positive scores. Many values are outside of the 95% confidence bounds, making  the sentiment score (and even the personality) largely unpredictable.

correlation plot

An extended analysis including more reference accounts would be necessary for further conclusion. Nevertheless, there is evidence of  mental instability as noticed already by various expert testimonials.

There is first the emergency situation his mental instability poses as a result of the power that he holds and the weapons he has at his disposal…There is first the emergency situation his mental instability poses as a result of the power that he holds and the weapons he has at his disposal. But there are also the effects on public health through his fomenting of violence. Hate crimes have seen unprecedented spikes, bullying is widespread, and white supremacist killings have doubled. There are also statistics on the rise of stress levels that are nationally worse than during World War II, the Vietnam War, the Cuban Missile Crisis, and September 11 terrorist attacks. He is also destabilizing the global scene by alienating allies, emboldening dictators, reigniting nuclear proliferation, and launching a trade war in ways that are predictable from his mental impairments. These are not just matters of policy but arise out of a troubled relationship with reality, a propensity to attack if questioned or even slightly criticized, and dangerous behavioral patterns that need to be spoken about.

There is not so much to add to man who believes in his “great and unmatched wisdom”. Frank Zappa once said “Politics is the entertainment branch of industry”.

Bad news are good news

e! Science News reports a new study in EPJ Data Science by Marcel Salathé showing that anti-vaccination sentiments spread more easily than pro-vaccination sentiments.

We find that the effects of neighborhood size and exposure intensity are qualitatively very different depending on the type of sentiment. Generally, we find that larger numbers of opinionated neighbors inhibit the expression of sentiments. We also find that exposure to negative sentiment is contagious

Read the full paper for the tricky design – at least the results fully underpin daily life experience. It’s certainly much easier to do Twitter than Facebook studies on the other hand these rather short messages are certainly not the main channel of many great “opinionated” people.

The third largest problem in epidemiology

Some people are writing their diaries on the web (“blogs”), other are sharing photos (“flickr”), their social background (“big brother”) or are broadcasting themselves (“YouTube”); others let you trace their current location (“twitter”) or look at their desktops (“wakoopa”) or computer files (“BitTorrent”). Why is it still so difficult to run an epidemiological study with an adequate response rate? Is that excessive profiling a minority habit only?