goodslides: Kansas theme
Michael W. Kearney
School of Journalism
Informatics Institute
University of Missouri
Michael W. Kearney
School of Journalism
Informatics Institute
University of Missouri
## 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)
ts_data
and trimts
are useful rtweet functionsts_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"))
foo <- function(n) {
data.frame(
var1 = rnorm(n),
var2 = rnorm(n)
)
}
df <- foo(10)
print(df)
## var1 var2
## 1 1.2550940 -2.1614949
## 2 0.8774562 0.9635271
## 3 1.6292473 -0.8959539
## 4 0.6926544 -0.6766164
## 5 1.5077352 1.9477026
## 6 -0.2652300 0.8850373
## 7 1.0913394 1.6788624
## 8 -0.1731676 0.1782695
## 9 -0.5003689 -1.3293232
## 10 -0.0732295 -1.1541722
Exposure to diversity higher than ever