### Imports library(tidyverse) ### Constants ### Definitions ratings <- "" ### Read in data bsides_nash_2018 <- readr::read_csv(ratings) ### Clean dataframe ### Save data # average of average of two scores bsides_nash_2018 %>% mutate(title = as.integer(as.factor(title))) %>% # mutate(title = stringr::str_wrap(stringr::str_sub(title, 1, 30), 14)) %>% # replace above line with this one to get titles group_by(title) %>% select(title, content_score, applicability_score) %>% gather("type", "score", -title) %>% summarize(score.ave = round(mean(score), 1)) %>% ungroup() %>% ggplot(aes(x=0, y=0, label=score.ave)) + geom_text() + viridis::scale_fill_viridis(option="D") + facet_wrap(~title) + theme( strip.text = element_text(size=6), panel.grid.minor = element_blank(), axis.ticks = element_blank(), legend.position='none', axis.text = element_blank(), axis.title = element_blank() ) ### median of average of two scores bsides_nash_2018 %>% mutate(title = as.integer(as.factor(title))) %>% # mutate(title = stringr::str_wrap(stringr::str_sub(title, 1, 30), 14)) %>% # replace above line with this one to get titles group_by(title) %>% select(title, content_score, applicability_score) %>% gather("type", "score", -title) %>% summarize(score.ave = round(median(score), 1)) %>% ungroup() %>% ggplot(aes(x=0, y=0, label=score.ave)) + geom_text() + viridis::scale_fill_viridis(option="D") + facet_wrap(~title) + theme( strip.text = element_text(size=6), panel.grid.minor = element_blank(), axis.ticks = element_blank(), legend.position='none', axis.text = element_blank(), axis.title = element_blank() ) ### Load data (run this if an Rda is already created) # Distribution of scores and median compared to overall median bsides_nash_2018 %>% mutate(title = as.integer(as.factor(title))) %>% # mutate(title = stringr::str_wrap(stringr::str_sub(title, 1, 30), 14)) %>% # replace above line with this one to get titles group_by(title) %>% mutate(content_score.title.median = median(content_score)) %>% mutate(applicability_score.title.median = median(applicability_score)) %>% ungroup() %>% mutate(content_score.overall.median = median(content_score)) %>% mutate(applicability_score.overall.median = median(applicability_score)) %>% ggplot(aes(x=content_score, applicability_score)) + geom_jitter(alpha=0.5) + geom_point(aes(x=content_score.title.median, y=applicability_score.title.median, group=title), color="red", alpha=0.1) + geom_point(aes(x=content_score.overall.median, y=applicability_score.overall.median, group=title), color="green", alpha=0.1) + scale_x_continuous(expand=c(0,0), limits=c(1,5), breaks=0:5) + scale_y_continuous(expand=c(0,0), limits=c(1,5), breaks=0:5) + facet_wrap(~title) + theme( strip.text = element_text(size=6), panel.grid.minor = element_blank(), axis.ticks = element_blank(), legend.position='none', axis.text = element_blank() ) uuid::UUIDgenerate() glimpse(bsides_nash_2018)