-
Notifications
You must be signed in to change notification settings - Fork 2
/
01-freqlist-code.R
30 lines (25 loc) · 1.33 KB
/
01-freqlist-code.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
library(tidyverse)
lexverbfiles <- dir("results", pattern = "lex", full.names = TRUE)
lexverbfiles
(editorial_ame <- read_csv(str_subset(lexverbfiles, "editorial-american"), skip = 2) |> mutate(variety = "AmE", genre = "editorial"))
(reportage_ame <- read_csv(str_subset(lexverbfiles, "reportage-american"), skip = 2) |> mutate(variety = "AmE", genre = "reportage"))
(editorial_bre <- read_csv(str_subset(lexverbfiles, "editorial-british"), skip = 2) |> mutate(variety = "BrE", genre = "editorial"))
(reportage_bre <- read_csv(str_subset(lexverbfiles, "reportage-british"), skip = 2) |> mutate(variety = "BrE", genre = "reportage"))
lxv <- bind_rows(editorial_ame, editorial_bre, reportage_ame, reportage_bre)
lxv
## tag by genres ====
lxv |>
filter(Frequency > 1000) |>
filter(Item %in% c("VVI", "VVN", "VVG", "VVD", "VVO", "VVZ")) |>
ggplot(aes(x = genre, y = `Relative frequency`, fill = Item)) +
geom_bar(stat = "identity", position = "dodge") +
theme_bw()
## tag by genres faceted by variety ====
lxv |>
filter(Frequency > 1000) |>
filter(Item %in% c("VVI", "VVN", "VVG", "VVD", "VVO", "VVZ")) |>
ggplot(aes(x = genre, y = `Relative frequency`, fill = Item)) +
geom_bar(stat = "identity", position = "dodge") +
facet_wrap(~variety) +
theme_bw()
ggsave("results/fig-01-lexical-verb-tags-by-variety.png", height = 4, width = 7)