This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
generated from 360-info/quarto-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.qmd
117 lines (110 loc) · 3.63 KB
/
index.qmd
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
title: "Violence against female journalists"
subtitle: "Visualising survey results"
author: "James Goldie, 360info"
date: "2022-04-27"
code-fold: true
theme: style/article.scss
---
```{r}
library(tidyverse)
library(here)
library(glue)
library(themes360info)
```
Let's bring the numbers in from the PR2Media survey, broken down by platform. I'm going to lengthene the data for plotting:
```{r}
survey_stats <-
read_csv(here("data", "survey-counts-by-medium.csv")) %>%
rename_with(
~ str_replace(str_replace(.x, "_n$", "-n"), "_p$", "-p"),
-c(medium, total_n))
# add a total row
totals <-
summarise(survey_stats,
medium = "All platforms",
total_n = sum(total_n),
across(ends_with("-n"), sum)) %>%
mutate(across(
ends_with("-n"),
list("prop" = ~ .x / total_n))) %>%
rename_with(~ str_replace(.x, "-n_prop$", "-p"))
# now lengthen
survey_stats %>%
bind_rows(totals) %>%
pivot_longer(
cols = -c(medium, total_n),
names_to = c("measure", ".value"),
names_sep = "-") %>%
# actually, i also want the inverse probabilities (ie. the nos) so that we can
# plot "solid bars"
rename(Yes_n = n, Yes_p = p) %>%
mutate(
No_n = total_n - Yes_n,
No_p = 1 - Yes_p) %>%
pivot_longer(
cols = -c(medium, total_n, measure),
names_to = c("response", ".value"),
names_sep = "_") %>%
mutate(
measure_long = recode(measure,
"has_bodyshaming" =
"Have you ever received<br>**body shaming comments**<br>online?",
"has_nonsex_comments" =
"Have you ever received<br>annoying/harassing<br>**non-sexualcomments?**",
"has_sexual_comments" =
"Have you ever received<br>annoying/harassing **sexual<br>comments?**",
"has_violent_threats" =
"Have you ever received<br>**threats of physical violence?**",
"has_doxxing" =
"Have you had your<br>**personal information<br>exposed?**",
"has_misinfo_slander" =
"Have you ever been a<br>victim of **misinformation<br>or slander?**",
"has_ethn_race_religion" =
"Have you ever received<br>an insult based on your<br>**ethnicity/religion/race?**",
"has_wiretapping_hacking" =
"Have you ever experienced<br>**wiretapping, hacking, interception<br>or monitoring** of your communications?",
)) ->
survey_long
```
For the most part, the numbers are pretty similar across platforms:
```{r}
survey_long %>%
{
ggplot(.) +
aes(y = p, x = medium, fill = response) +
geom_col(position = "stack") +
geom_text(
aes(label =
glue("{scales::percent(p, accuracy = 1)} of {scales::number(total_n)}")),
data = filter(., response == "Yes"),
hjust = "left", nudge_y = 0.05,
family = "Body 360info", size = 3,
colour = colours_360("darkgrey")) +
facet_wrap(vars(measure_long)) +
coord_flip() +
scale_y_continuous(limits = c(0, 1), labels = scales::percent_format()) +
scale_fill_manual(
values =
colours_360("lightblue", "lightgrey") %>%
set_names("Yes", "No"),
guide = NULL) +
theme_360() +
theme(
panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank(),
panel.grid.minor.x = element_blank(),
strip.text = element_textbox(height = unit(50, "points"), hjust = 0)) +
labs(
x = NULL, y = NULL,
title = toupper("Violence against female journalists"),
caption = paste(
"**CHART:** James Goldie, 360info",
"**DATA:** PR2Media",
sep = "<br>"
)
)
} %>%
save_360plot(here("out", "survey-responses-by-medium.png"))
knitr::include_url(here("out", "survey-responses-by-medium.png"))
```