-
Notifications
You must be signed in to change notification settings - Fork 2
/
analyzeResults.R
41 lines (29 loc) · 943 Bytes
/
analyzeResults.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
library(tidyverse)
library(DT)
library(data.table)
library(yaml)
library(rstudioapi)
file <- selectFile(caption = "Select File", label = "Select",
path = getActiveProject(), filter = "All YAML Files (*.yml)",
existing = TRUE)
config <- read_yaml(file)
# read results
rds_filename <- config$outputfilename
results_data <- read_rds(rds_filename)
user <- results_data$user
exposure <- results_data$exposure
# analyze results
user %>% ggplot() +
aes(topic_1) + geom_histogram()
names(exposure) <- paste0("V", 1:dim(exposure)[2])
df <- as_tibble(exposure) %>%
rownames_to_column() %>%
rename(news_post = rowname) %>%
gather(step, value, -news_post) %>%
mutate(step = str_remove(step, "V")) %>%
mutate(step = as.numeric(step)) %>%
mutate(news_post = factor(news_post))
df %>% ggplot() +
aes(x = step, y = value, color = news_post) +
geom_line() +
guides(color = FALSE)