-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
162 lines (123 loc) · 4.32 KB
/
README.Rmd
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
output: pal::gitlab_document
---
```{r}
#| label: init
#| include: false
knitr::opts_knit$set(root.dir = getwd())
library(rlang,
include.only = "%|%")
library(magrittr,
include.only = c("%>%", "%<>%", "%T>%", "%!>%", "%$%"))
```
# `r pal::desc_value("Package")`
```{r}
#| label: pkg-desc
#| results: asis
#| echo: false
pal::cat_lines(paste0("[![CRAN Status](https://r-pkg.org/badges/version/", pal::desc_value(key = "Package"), ")](https://cran.r-project.org/package=",
pal::desc_value(key = "Package"), "){.pkgdown-release}"),
"",
pal::desc_value("Description"))
```
***Porting all the functionality from the legacy [`fokus_aargau` repository](https://gitlab.com/c2d-zda/fokus_aargau/) to this R package and the separate
[`fokus_reports` Quarto project](https://gitlab.com/zdaarau/fokus_reports) is still work in progress.***
```{r}
#| label: pkg-doc
#| eval: !expr '!isTRUE(getOption("pal.build_readme.is_pkgdown"))'
#| results: asis
#| echo: false
pkgsnip::md_snip(id = "pkgdown_site") %>%
paste0("## Documentation\n\n",
"[![Netlify Status](https://api.netlify.com/api/v1/badges/0cc31095-153a-4d21-bec7-be8dd936ddf1/deploy-status)]",
"(https://app.netlify.com/sites/fokus-rpkg-dev/deploys)\n\n",
.) |>
pal::cat_lines()
```
## Installation
```{r}
#| label: pkg-instl-dev
#| child: !expr pkgsnip::snip_path("pkg-instl-dev-gitlab.Rmd")
```
```{r}
#| label: pkg-usage
#| eval: !expr isTRUE(getOption("pal.build_readme.is_pkgdown"))
#| results: asis
#| echo: false
pkgsnip::md_snip(id = "pkg_usage") %>%
paste0("## Usage\n\n", .) |>
pal::cat_lines()
```
## Package configuration
```{r}
#| label: pkg-config
#| child: !expr pkgsnip::snip_path("pkg-config.Rmd")
```
## Questionnaires
[![Netlify
Status](https://api.netlify.com/api/v1/badges/16855d14-c491-42cd-bc9d-a346e16b6672/deploy-status)](https://app.netlify.com/sites/qstnr-fokus-ag/deploys)
Generated survey questionnaires are automatically deployed to `qstnr.fokus.ag/{ballot_date}_{canton}.{ext}`, where `{ext}` is one of `html`, `md`, `csv` or
`xlsx`. The following questionnaires are available:
```{r}
#| label: qstnrs
#| echo: false
#| results: "asis"
fokus::all_ballot_dates |>
purrr::map_chr(\(ballot_date) {
fokus::cantons(ballot_date = ballot_date) |>
purrr::map_chr(\(canton) {
url_start <- glue::glue(fokus:::url_qstnr[[canton]], "/{ballot_date}_{canton}")
glue::glue("- {ballot_date} {stringr::str_to_title(canton)}: ",
"[{fontawesome::fa(name = 'fab fa-html5')}]({url_start}.html) | ",
"[{fontawesome::fa(name = 'fab fa-markdown')}]({url_start}.md) | ",
"[{fontawesome::fa(name = 'fas fa-file-csv')}]({url_start}.csv) | ",
"[{fontawesome::fa(name = 'fas fa-file-excel')}]({url_start}.xlsx)")
}) |>
paste0(collapse = "\n")
}) |>
paste0(collapse = "\n") |>
cat()
```
## Private FOKUS directory structure
```{r}
#| label: fokus-private-desc
#| child: "data-raw/snippets/fokus_private_description.Rmd"
```
<details>
<summary><strong>Directory structure schema</strong></summary>
```{r}
#| label: fokus-private-schema
#| echo: false
#| results: "asis"
fokus:::print_private_repo_structure()
```
</details>
## Development
### R Markdown format
```{r}
#| label: pkgpurl
#| child: !expr pkgsnip::snip_path("pkgpurl.Rmd")
```
### Coding style
```{r}
#| label: pkg-code-style
#| child: !expr pkgsnip::snip_path("pkg-code-style.Rmd")
```
### Abbreviations
The abbreviations used to name things (function and parameter names etc.) in this package include:
<details>
<summary><strong>Table of abbreviations</strong></summary>
```{r}
#| label: abbrs
#| echo: false
fokus:::abbrs() |>
# flatten list col to comma-separted char col in order to avoid weird whitespacing before (some) commas (apparently `pal::pipe_table()` has flaws)
dplyr::mutate(full_expressions = purrr::map_chr(full_expressions,
\(x) cli::ansi_collapse(x = x,
sep2 = ", ",
last = ", "))) |>
dplyr::rename("Full expression(s)" = full_expressions,
"Abbreviation" = abbreviation) |>
pal::pipe_table()
```
</details>