Skip to content

Commit c1cd8ce

Browse files
committed
switch from purrr::when() to pal::when()
and regenerate doc
1 parent 7beeea9 commit c1cd8ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+24192
-39
lines changed

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: swissmuni
22
Title: Download Municipality Data from the Swiss Federal Statistical
33
Office's Web Services
4-
Version: 0.4.3
4+
Version: 0.4.3.9000
55
Authors@R:
66
person("Salim", "Brüggemann", , "[email protected]", role = c("aut", "cre"),
77
comment = c(ORCID = "0000-0002-5329-5987"))
@@ -21,8 +21,8 @@ Imports:
2121
httr (>= 1.4.1),
2222
lubridate (>= 1.7.9),
2323
magrittr (>= 1.5),
24-
pal (>= 0.0.9073),
25-
pkgpins (>= 0.7.0),
24+
pal (>= 0.0.9091),
25+
pkgpins (>= 0.7.0.9004),
2626
purrr (>= 0.3.4),
2727
readr (>= 1.3.1),
2828
rlang (>= 0.4.6),
@@ -41,4 +41,4 @@ Remotes:
4141
Encoding: UTF-8
4242
LazyData: true
4343
Roxygen: list(markdown = TRUE)
44-
RoxygenNote: 7.2.2
44+
RoxygenNote: 7.2.3

R/swissmuni.gen.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ as_api_date <- function(date) {
3535
checkmate::assert_date(any.missing = FALSE,
3636
null.ok = TRUE,
3737
.var.name = "start/end_date") %>%
38-
purrr::when(length(.) == 0L ~ NULL,
39-
~ format(., "%d-%m-%Y"))
38+
pal::when(length(.) == 0L ~ NULL,
39+
~ format(., "%d-%m-%Y"))
4040
}
4141

4242
#' Get allowed API URL parameters

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,32 @@ remotes::install_gitlab(repo = "salim_b/r/pkgs/swissmuni")
3131

3232
This package’s source code is written in the [R Markdown](https://rmarkdown.rstudio.com/) file format to facilitate practices commonly referred to as [*literate programming*](https://en.wikipedia.org/wiki/Literate_programming). It allows the actual code to be freely mixed with explanatory and supplementary information in expressive Markdown format instead of having to rely on [`#` comments](https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Comments) only.
3333

34-
All the `.gen.R` suffixed R source code found under [`R/`](R/) is generated from the respective R Markdown counterparts under [`Rmd/`](Rmd/) using [`pkgpurl::purl_rmd()`](https://rpkg.dev/pkgpurl/reference/purl_rmd.html)[^2]. Always make changes only to the `.Rmd` files – never the `.R` files – and then run `pkgpurl::purl_rmd()` to regenerate the R source files.
34+
All the `.gen.R` suffixed R source code found under [`R/`](R/) is generated from the respective R Markdown counterparts under [`Rmd/`](Rmd/) using [`pkgpurl::purl_rmd()`](https://pkgpurl.rpkg.dev/dev/reference/purl_rmd.html)[^2]. Always make changes only to the `.Rmd` files – never the `.R` files – and then run `pkgpurl::purl_rmd()` to regenerate the R source files.
3535

3636
### Coding style
3737

3838
This package borrows a lot of the [Tidyverse](https://www.tidyverse.org/) design philosophies. The R code adheres to the principles specified in the [Tidyverse Design Guide](https://principles.tidyverse.org/) wherever possible and is formatted according to the [Tidyverse Style Guide](https://style.tidyverse.org/) (TSG) with the following exceptions:
3939

4040
- Line width is limited to **160 characters**, double the [limit proposed by the TSG](https://style.tidyverse.org/syntax.html#long-lines) (80 characters is ridiculously little given today’s high-resolution wide screen monitors).
4141

42+
Furthermore, the preferred style for breaking long lines differs. Instead of wrapping directly after an expression’s opening bracket as [suggested by the TSG](https://style.tidyverse.org/syntax.html#long-lines), we prefer two fewer line breaks and indent subsequent lines within the expression by its opening bracket:
43+
44+
``` r
45+
# TSG proposes this
46+
do_something_very_complicated(
47+
something = "that",
48+
requires = many,
49+
arguments = "some of which may be long"
50+
)
51+
52+
# we prefer this
53+
do_something_very_complicated(something = "that",
54+
requires = many,
55+
arguments = "some of which may be long")
56+
```
57+
58+
This results in less vertical and more horizontal spread of the code and better readability in pipes.
59+
4260
- Usage of [magrittrs compound assignment pipe-operator `%<>%`](https://magrittr.tidyverse.org/reference/compound.html) is desirable[^3].
4361

4462
- Usage of [Rs right-hand assignment operator `->`](https://rdrr.io/r/base/assignOps.html) is not allowed[^4].

Rmd/swissmuni.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ as_api_date <- function(date) {
111111
checkmate::assert_date(any.missing = FALSE,
112112
null.ok = TRUE,
113113
.var.name = "start/end_date") %>%
114-
purrr::when(length(.) == 0L ~ NULL,
115-
~ format(., "%d-%m-%Y"))
114+
pal::when(length(.) == 0L ~ NULL,
115+
~ format(., "%d-%m-%Y"))
116116
}
117117
```
118118

docs/404.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/TODO.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/authors.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)