Skip to content

Commit 2ed92b6

Browse files
committed
Merge branch 'fix_pipes' into 'main'
Fix pipes See merge request lpjml/lpjmlstats!30
2 parents d4e431e + 4bf29aa commit 2ed92b6

8 files changed

Lines changed: 39 additions & 36 deletions

File tree

.buildlibrary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ValidationKey: '1905849'
1+
ValidationKey: '1926436'
22
AutocreateReadme: yes
33
AcceptedWarnings:
44
- 'Warning: package ''.*'' was built under R version'

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ cff-version: 1.2.0
22
message: If you use this software, please cite it using the metadata from this file.
33
type: software
44
title: 'lpjmlstats: Statistical tools for LPJmL data analysis'
5-
version: 0.9.3
6-
date-released: '2026-02-09'
5+
version: 0.9.4
6+
date-released: '2026-02-10'
77
abstract: This package provides statistical tools for LPJmL data analysis to be used
88
for benchmarking LPJmL outputs.
99
authors:

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: lpjmlstats
22
Title: Statistical tools for LPJmL data analysis
3-
Version: 0.9.3
3+
Version: 0.9.4
44
Authors@R: c(
55
person("David","Hötten", , "davidho@pik-potsdam.de", role = c("aut", "cre")),
66
person("Jannes","Breier", , "jannes.breier@pik-potsdam.de", role = c("aut"), comment = c(ORCID = "0000-0002-9055-6904")),
@@ -46,5 +46,5 @@ Config/testthat/edition: 3
4646
VignetteBuilder: knitr
4747
Depends:
4848
R (>= 3.5.0)
49-
Date: 2026-02-09
49+
Date: 2026-02-10
5050
BinaryFiles: inst/bin2cdf

R/Metric_subclasses.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ GlobSumTimeAvgTable <- # nolint: object_name_linter.
1616
#' @param data LPJmLDataCalc object to be summarized
1717
#' @return A summarized \link{LPJmLDataCalc} object
1818
summarize = function(data) {
19-
data %>%
20-
aggregate(cell = list(to = "global", stat = "weighted_sum")) %>%
19+
data |>
20+
aggregate(cell = list(to = "global", stat = "weighted_sum")) |>
2121
aggregate(time = list(to = "sim_period", stat = "mean"))
2222
},
2323

@@ -94,8 +94,8 @@ GlobAvgTimeAvgTable <- R6::R6Class( # nolint: object_name_linter.
9494
#' @param data LPJmLDataCalc object to be summarized
9595
#' @return A summarized \link{LPJmLDataCalc} object
9696
summarize = function(data) {
97-
data %>%
98-
aggregate(cell = list(to = "global", stat = "weighted_mean")) %>%
97+
data |>
98+
aggregate(cell = list(to = "global", stat = "weighted_mean")) |>
9999
aggregate(time = list(to = "sim_period", stat = "mean"))
100100
},
101101

@@ -129,7 +129,7 @@ GlobSumTimeseries <- R6::R6Class( # nolint: object_name_linter.
129129
#' @param data LPJmLDataCalc object to be summarized
130130
#' @return A summarized \link{LPJmLDataCalc} object
131131
summarize = function(data) {
132-
data %>%
132+
data |>
133133
aggregate(cell = list(to = "global", stat = "weighted_sum"))
134134
},
135135

@@ -198,7 +198,7 @@ GlobAvgTimeseries <- R6::R6Class( # nolint: object_name_linter.
198198
#' @param data LPJmLDataCalc object to be summarized
199199
#' @return A summarized \link{LPJmLDataCalc} object
200200
summarize = function(data) {
201-
data %>%
201+
data |>
202202
aggregate(cell = list(to = "global", stat = "weighted_mean"))
203203
},
204204

@@ -229,8 +229,8 @@ GlobSumAnnAvgTimeseries <- # nolint: object_name_linter.
229229
#' @param data LPJmLDataCalc object to be summarized
230230
#' @return A summarized \link{LPJmLDataCalc} object
231231
summarize = function(data) {
232-
data %>%
233-
aggregate(time = list(to = "years", stat = "mean")) %>%
232+
data |>
233+
aggregate(time = list(to = "years", stat = "mean")) |>
234234
aggregate(cell = list(to = "global", stat = "weighted_sum"))
235235
},
236236

@@ -261,8 +261,8 @@ GlobAvgAnnAvgTimeseries <- R6::R6Class( # nolint: object_name_linter.
261261
#' @param data LPJmLDataCalc object to be summarized
262262
#' @return A summarized \link{LPJmLDataCalc} object
263263
summarize = function(data) {
264-
data %>%
265-
aggregate(time = list(to = "years", stat = "mean")) %>%
264+
data |>
265+
aggregate(time = list(to = "years", stat = "mean")) |>
266266
aggregate(cell = list(to = "global", stat = "weighted_mean"))
267267
},
268268

@@ -293,7 +293,7 @@ CellSubsetAnnAvgTimeseries <- # nolint: object_name_linter.
293293
#' @param lpjml_data LPJmLDataCalc object to be summarized
294294
#' @return A summarized \link{LPJmLDataCalc} object
295295
summarize = function(lpjml_data) {
296-
subset(lpjml_data, cell = self$m_options$cell) %>%
296+
subset(lpjml_data, cell = self$m_options$cell) |>
297297
aggregate(time = list(to = "years", stat = "mean"))
298298
},
299299

@@ -380,7 +380,7 @@ TimeAvgMap <- # nolint: object_name_linter.
380380
#' @param data LPJmLDataCalc object to be summarized
381381
#' @return A summarized \link{LPJmLDataCalc} object
382382
summarize = function(data) {
383-
data %>%
383+
data |>
384384
aggregate(time = list(to = "sim_period", stat = "mean"))
385385
},
386386

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Statistical tools for LPJmL data analysis
22

3-
R package **lpjmlstats**, version **0.9.3**
3+
R package **lpjmlstats**, version **0.9.4**
44

55
[![CRAN status](https://www.r-pkg.org/badges/version/lpjmlstats)](https://cran.r-project.org/package=lpjmlstats) [![R build status](https://github.com/PIK-LPJmL/lpjmlstats/workflows/check/badge.svg)](https://github.com/PIK-LPJmL/lpjmlstats/actions) [![codecov](https://codecov.io/gh/PIK-LPJmL/lpjmlstats/branch/master/graph/badge.svg)](https://app.codecov.io/gh/PIK-LPJmL/lpjmlstats) [![r-universe](https://pik-piam.r-universe.dev/badges/lpjmlstats)](https://pik-piam.r-universe.dev/builds)
66

@@ -48,17 +48,17 @@ In case of questions / problems please contact David Hötten <davidho@pik-potsda
4848

4949
To cite package **lpjmlstats** in publications use:
5050

51-
Hötten D, Breier J, Müller C, Wirth S (2026). "lpjmlstats: Statistical tools for LPJmL data analysis." Version: 0.9.3, <https://github.com/PIK-LPJmL/lpjmlstats>.
51+
Hötten D, Breier J, Müller C, Wirth S (2026). "lpjmlstats: Statistical tools for LPJmL data analysis." Version: 0.9.4, <https://github.com/PIK-LPJmL/lpjmlstats>.
5252

5353
A BibTeX entry for LaTeX users is
5454

5555
```latex
5656
@Misc{,
5757
title = {lpjmlstats: Statistical tools for LPJmL data analysis},
5858
author = {David Hötten and Jannes Breier and Christoph Müller and Stephen B. Wirth},
59-
date = {2026-02-09},
59+
date = {2026-02-10},
6060
year = {2026},
6161
url = {https://github.com/PIK-LPJmL/lpjmlstats},
62-
note = {Version: 0.9.3},
62+
note = {Version: 0.9.4},
6363
}
6464
```

inst/Benchmark_markdown.Rmd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ sim_table <- attr(bench_data, "sim_table")
5252
5353
# manually escape special character ":" and "_"
5454
sim_table <-
55-
sim_table %>%
55+
sim_table |>
5656
dplyr::mutate_all(escape_latex_special_chars)
5757
5858
# reorder columns as they should be displayed
59-
tabl <- sim_table %>% dplyr::select(sim_names,
60-
sim_ident,
61-
sim_type,
62-
lpjml_version)
59+
tabl <- sim_table |> dplyr::select(sim_names,
60+
sim_ident,
61+
sim_type,
62+
lpjml_version)
6363
6464
# create and style table
6565
knitr::kable(
@@ -70,16 +70,16 @@ knitr::kable(
7070
escape = FALSE,
7171
# allow latex commands but depends on manual escaping
7272
col.names = c("Sim Name", "Sim Identifier", "Sim Type", "Version")
73-
) %>%
73+
) |>
7474
kableExtra::kable_styling(font_size = 8,
7575
latex_options = c("HOLD_position"))
7676
```
7777
\vspace{2cm}
7878
\textbf{Simulation Paths}
7979
```{r print-simulation-paths, results='asis'}
8080
# select relevant columns and make font size of paths very small
81-
tabl <- sim_table %>%
82-
dplyr::mutate(sim_paths = paste0("\\tiny ", sim_paths)) %>%
81+
tabl <- sim_table |>
82+
dplyr::mutate(sim_paths = paste0("\\tiny ", sim_paths)) |>
8383
dplyr::select(sim_ident, sim_paths)
8484
8585
# create and style table
@@ -89,7 +89,7 @@ knitr::kable(
8989
booktabs = TRUE,
9090
escape = FALSE,
9191
col.names = c("Sim Identifier", "Sim Path")
92-
) %>%
92+
) |>
9393
kableExtra::kable_styling(font_size = 8,
9494
latex_options = c("HOLD_position"))
9595
```

tests/testthat/testLPJmLDataCalc_aggregate.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ test_that("usecases of aggregation with cow and plotting runs error free", {
138138
soiln$add_grid()
139139

140140
# usecase 1: subset and plot
141-
expect_no_error(soiln %>% subset(time = 1) %>% plot())
141+
expect_no_error(soiln |> subset(time = 1) |> plot())
142142

143143
# usecase 2: aggregate, subset and plot
144144
expect_no_error(
145-
soiln %>%
146-
aggregate(cell = list(to = "countries", stat = "sum")) %>%
147-
subset(time = 1) %>%
145+
soiln |>
146+
aggregate(cell = list(to = "countries", stat = "sum")) |>
147+
subset(time = 1) |>
148148
plot()
149149
)
150150
})
@@ -158,7 +158,7 @@ test_that("usecases of aggregation with cow integral on multiple timesteps ",
158158
soiln$add_grid()
159159

160160
# aggregate multiple time steps #nolint
161-
expect_no_error(soiln %>%
161+
expect_no_error(soiln |>
162162
aggregate(cell =
163163
list(to = "countries", stat = "sum")))
164164

@@ -334,7 +334,7 @@ test_that("grid for aggregation is loaded automatically", {
334334
path_to_soil_n_json <-
335335
test_path("../testdata/path1", "soiln.bin.json")
336336
soiln <- read_io_calc(path_to_soil_n_json)
337-
expect_no_error(soiln %>% aggregate(cell = list(to = "global", stat = "sum")))
337+
expect_no_error(soiln |> aggregate(cell = list(to = "global", stat = "sum")))
338338
})
339339

340340

vignettes/.lintr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ linters: lucode2::lintrRules(allowUndesirable = TRUE,
22
modification = list(object_name_linter = lintr::object_name_linter(styles = "snake_case"),
33
absolute_path_linter = NULL))
44
encoding: "UTF-8"
5+
exclusions: [
6+
"\\.R$"
7+
]

0 commit comments

Comments
 (0)