A teeny tiny Twitter tale

November 5, 2017

(This article was first published on HighlandR, and kindly contributed to R-bloggers)

Use of social media within the NHS to raise awareness of dangerous conditions –

We had an event at work today, bringing together clinicians and QI staff across a range of disciplines and services to provide some education and raise awareness of work that is being undertaken to recognise and treat Sepsis.

We tried to encourage folk to tweet, using the hashtag “#nhshsepsis” (you can also follow our sepsis twitter account on @nhshsepsis to learn more about this dangerous condition and the work we are doing in Highland).

There weren’t a huge amount of tweets, at the time of writing this, but there were enough to justify installing rtweet and taking a look.

I haven’t covered the necessary setup in terms of creating an application – take a look at https://apps.twitter.com/ and also the rtweet package help, you should be able to get yourself going without too much issue.
The main thing to remember is that you will need to set a callback URL of

Gist below – should all be pretty self explanatory – looking at the number of tweets, the most favourited, and the most influential (based on likes/RT) tweeter.


Also a wee look at the devices being used – there’s quite a lot of info that can be gleaned from the Twitter API.


There are many functions that I have not even looked at yet, but the key function of simply returning all the tweets with the relevant hashtag was very straightforward.

With this package, stringr and tidytext, there is a lot that can be done to analyse data from what seems to be the social media channel of choice for the #rstats afficionado


To leave a comment for the author, please follow the link and comment on their blog: HighlandR.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)