-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
117 lines (90 loc) · 3.39 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
---
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"))
```
```{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/ce410db6-b85a-4707-9358-f0d3449398c3/deploy-status)]",
"(https://app.netlify.com/sites/swissevote-rpkg-dev/deploys)\n\n",
.) |>
pal::cat_lines()
```
## Details
### Raw data files
The **cantonal raw data files** are *not* included in this package due to legal restrictions and/or concerns regarding voter privacy and thus **have to be
provided by the user**. The path to the folder holding these files must be set via the [package configuration
key](https://pal.rpkg.dev/reference/pkg_config_val.html) **`path_raw_data`** (e.g. by setting the R option `swissevote.path_raw_data`) and the files under this
path are expected to be organized and named in the following way:
``` fs
[swissevote.path_raw_data]/
├──BE/
| ├──BE_YYYY-MM-DD.EXT
| └──...
├──GE/
| ├──vYYYYNN.EXT
| └──...
└──NE/
├──NE_YYYY-MM-DD.EXT
└──...
```
The Genevan raw data files must be named according to the column `filename` in `swissevote:::metadata_geneva_raw_datasets` (which has been defined by the Geneva
State Chancellery). Raw data files from the other cantons must be named by the canton abbreviation and the ballot date (e.g. `NE_2019-02-10`).
### Caching
Time-consuming operations like reading in the raw datasets or scraping ballot dates from cantonal websites are cached to the local filesystem by default (using
[pkgpins](https://pkgpins.rpkg.dev)). The maximum cache age for all affected functions can be set via the package configuration key **`global_max_cache_age`**
[^1] (defaults to *`r pal::pkg_config_val_default(key = "global_max_cache_age", pkg = "swissevote")`* if unset).
[^1]: Its value must be a valid [lubridate duration](https://lubridate.tidyverse.org/reference/as.duration.html#details) which can be a natural-language string
like `"2 days 1 minute 30 seconds"` (or short `2d1min30s`).
## 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")
```
## 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")
```