goodslides: Mizzou 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 0.3094458 -1.8049045
## 2 -0.2419304 1.5845365
## 3 0.3152654 0.4575290
## 4 0.1839490 1.2531591
## 5 0.8986711 -1.2675510
## 6 -2.1633067 0.1185645
## 7 1.5178643 2.5652821
## 8 -1.2173586 -0.2077794
## 9 0.2285043 0.1167743
## 10 -0.8806099 -0.4850999
Exposure to diversity higher than ever