Goodslides: Custom theme

Michael W. Kearney
School of Journalism
Informatics Institute
University of Missouri

rtweet pkg

## load rtweet dplyr and ggplot2
library(rtweet)
library(dplyr)
library(ggplot2)
## stream
rt <- stream_tweets(timeout = 30, verbose = FALSE)
## group by english and non-english
rt$eng <- ifelse(
    rt$lang == "en" & !is.na(rt$lang), "English", "Non-English"
  )
rt <- group_by(rt, eng)

Plot time series of tweets

ts_data(rt, "5 secs") %>%
  trimts(1, 1) %>%
  ggplot(aes(x = time, y = n)) +
  geom_smooth(method = "loess", aes(group = eng), colour = "#aa00cc", alpha = .3) +
  geom_point(aes(fill = eng), shape = 21, size = 3.5, alpha = .7) +
  labs(title = "Filtering Twitter's stream API using stop words",
       subtitle = "Tweets collected and aggregated in 10 second
       intervals in R using rtweet") +
  ggthemes::theme_fivethirtyeight(base_size = 18) +
  theme(legend.title = element_blank()) +
  scale_color_manual(values = c("#5577fa", "#df6666")) +
  scale_fill_manual(values = c("#5577fa", "#df6666"))

R code example

foo <- function(n) {
  data.frame(
    var1 = rnorm(n),
    var2 = rnorm(n)
  )
}
df <- foo(10)
print(df)
##            var1        var2
## 1  -0.324496769 -0.26676898
## 2  -0.514488441  0.33214702
## 3   0.647522776  0.19569984
## 4   0.345774165 -0.97835044
## 5   0.666491212 -0.50410010
## 6   0.567890358 -0.19832418
## 7   0.079419159 -0.25285570
## 8  -0.984807787  1.40425936
## 9   0.009933486 -1.00330272
## 10 -1.149808591  0.01485205

 

And now some content

Content

Exposure to diversity higher than ever

 

That's all!