-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatures.qmd
executable file
·97 lines (83 loc) · 3.23 KB
/
features.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
---
output: html_document
editor_options:
chunk_output_type: console
---
::: {.content-visible when-profile="russian"}
## Признаки
```{r}
#| echo: false
#| message: false
library(tidyverse)
library(DT)
# table with features
db <- readxl::read_xlsx("data/data.xlsx")
db |>
mutate(standardness = if_else(non_standard == 0, 'носители, недопускающие нелитературные формы', 'носители, допускающие нелитературные формы')) |>
group_by(feature_id) |>
mutate(fully_st = sum(non_standard == 0),
n_fully_st = sum(non_standard != 0),
standardness = str_c(n_fully_st, " из ", fully_st+n_fully_st, " носителей"),
feature_id0 = sprintf(str_c("%0", nchar(max(feature_id)), "d_"), feature_id),
filename = str_replace_all(feature_title, "[\\s:\\./]", "_"),
filename = str_remove_all(filename, "\\*"),
filename = str_to_lower(filename),
filename = str_c(feature_id0, filename),
feature_title = str_c("<a href='",
filename,
".html'>",
feature_title,
"</a>"),
for_sorting = n_fully_st/fully_st) |>
arrange(-for_sorting) |>
select(feature_title, standardness, contributor) |>
rename(`название признака` = feature_title,
`литературность` = standardness,
`исследователи` = contributor) |>
distinct() |>
DT::datatable(filter = 'top',
escape = FALSE,
rownames = FALSE,
options = list(pageLength = 150,
autoWidth = TRUE,
dom = 'fltpi'))
```
:::
::: {.content-visible when-profile="english"}
## Features
```{r}
#| echo: false
#| message: false
library(tidyverse)
library(DT)
# table with features
db <- readxl::read_xlsx("data/data.xlsx")
db |>
mutate(standardness = if_else(non_standard == 0, 'fully standard speakers', 'non-fully standard speakers')) |>
group_by(feature_id) |>
mutate(fully_st = sum(non_standard == 0),
n_fully_st = sum(non_standard != 0),
standardness = str_c(n_fully_st, " out of ", n_fully_st+fully_st, " speakers"),
feature_id0 = sprintf(str_c("%0", nchar(max(feature_id)), "d_"), feature_id),
filename = str_replace_all(feature_title, "[\\s:\\./]", "_"),
filename = str_remove_all(filename, "\\*"),
filename = str_to_lower(filename),
filename = str_c(feature_id0, filename),
feature_title = str_c("<a href='",
filename,
".html'>",
feature_title,
"</a>"),
for_sorting = n_fully_st/fully_st) |>
arrange(-for_sorting) |>
select(feature_title, standardness, contributor) |>
rename(feature = feature_title) |>
distinct() |>
DT::datatable(filter = 'top',
escape = FALSE,
rownames = FALSE,
options = list(pageLength = 150,
autoWidth = TRUE,
dom = 'fltpi'))
```
:::