Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '67749080'
ValidationKey: '67967040'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'madrat: May All Data be Reproducible and Transparent (MADRaT) *'
version: 3.31.0
date-released: '2026-01-15'
version: 3.32.0
date-released: '2026-01-19'
abstract: Provides a framework which should improve reproducibility and transparency
in data processing. It provides functionality such as automatic meta data creation
and management, rudimentary quality management, data caching, work-flow management
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: madrat
Title: May All Data be Reproducible and Transparent (MADRaT) *
Version: 3.31.0
Date: 2026-01-15
Version: 3.32.0
Date: 2026-01-19
Authors@R: c(
person("Jan Philipp", "Dietrich", , "[email protected]", role = c("aut", "cre"),
comment = c(affiliation = "Potsdam Institute for Climate Impact Research", ORCID = "0000-0002-4309-6431")),
Expand Down
10 changes: 5 additions & 5 deletions R/toolAggregate.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ toolAggregate <- function(x,
} else {
result <- toolAggregateUnweighted(x = x, rel = rel, to = to, dim = dim, xComment = xComment)
}
return(result)
return(removeEmptyResultItems(result, dim = dim))
}

toolAggregateWeighted <- function(x, rel, weight, from, to, dim, wdim, partrel,
Expand Down Expand Up @@ -422,10 +422,10 @@ toolGetAggregationMatrix <- function(rel, from = NULL, to = NULL, items = NULL,
}
}

regions <- as.character(unique(rel[, to]))
countries <- as.character(unique(rel[, from]))
m <- Matrix::Matrix(data = 0, nrow = length(regions), ncol = length(countries),
dimnames = list(regions = regions, countries = countries))
toItems <- as.character(unique(rel[, to]))
fromItems <- as.character(unique(rel[, from]))
m <- Matrix::Matrix(data = 0, nrow = length(toItems), ncol = length(fromItems),
dimnames = list(toItems = toItems, fromItems = fromItems))
m[cbind(match(rel[, to], rownames(m)), match(rel[, from], colnames(m)))] <- 1
if (is.numeric(to)) {
to <- dimnames(rel)[[2]][to]
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# May All Data be Reproducible and Transparent (MADRaT) *

R package **madrat**, version **3.31.0**
R package **madrat**, version **3.32.0**

[![CRAN status](https://www.r-pkg.org/badges/version/madrat)](https://cran.r-project.org/package=madrat) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1115490.svg)](https://doi.org/10.5281/zenodo.1115490) [![R build status](https://github.com/pik-piam/madrat/workflows/check/badge.svg)](https://github.com/pik-piam/madrat/actions) [![codecov](https://codecov.io/gh/pik-piam/madrat/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/madrat) [![r-universe](https://pik-piam.r-universe.dev/badges/madrat)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -55,7 +55,7 @@ In case of questions / problems please contact Jan Philipp Dietrich <dietrich@pi

To cite package **madrat** in publications use:

Dietrich J, Sauer P, Baumstark L, Wirth S, Giannousakis A, Rodrigues R, Bodirsky B, Leip D, Crawford M, Kreidenweis U, Klein D, Rein P (2026). "madrat: May All Data be Reproducible and Transparent (MADRaT) *." doi:10.5281/zenodo.1115490 <https://doi.org/10.5281/zenodo.1115490>, Version: 3.31.0, <https://github.com/pik-piam/madrat>.
Dietrich J, Sauer P, Baumstark L, Wirth S, Giannousakis A, Rodrigues R, Bodirsky B, Leip D, Crawford M, Kreidenweis U, Klein D, Rein P (2026). "madrat: May All Data be Reproducible and Transparent (MADRaT) *." doi:10.5281/zenodo.1115490 <https://doi.org/10.5281/zenodo.1115490>, Version: 3.32.0, <https://github.com/pik-piam/madrat>.

A BibTeX entry for LaTeX users is

Expand All @@ -64,9 +64,9 @@ A BibTeX entry for LaTeX users is
title = {madrat: May All Data be Reproducible and Transparent (MADRaT) *},
author = {Jan Philipp Dietrich and Pascal Sauer and Lavinia Baumstark and Stephen Wirth and Anastasis Giannousakis and Renato Rodrigues and Benjamin Leon Bodirsky and Debbora Leip and Michael Crawford and Ulrich Kreidenweis and David Klein and Patrick Rein},
doi = {10.5281/zenodo.1115490},
date = {2026-01-15},
date = {2026-01-19},
year = {2026},
url = {https://github.com/pik-piam/madrat},
note = {Version: 3.31.0},
note = {Version: 3.32.0},
}
```
10 changes: 8 additions & 2 deletions tests/testthat/test-toolAggregate.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ test_that("zeroWeight = fix works", {

test_that("empty cells in a to column do not result in aggregated data", {

skip()

empty <- ""

## dim 1
Expand Down Expand Up @@ -338,4 +336,12 @@ test_that("empty cells in a to column do not result in aggregated data", {
expect_equal(noC(toolAggregate(x, rel)),
new.magpie(c("AGG", "NULL"), "", fill = 100))

## Explicitly passed subdim works
x <- new.magpie(c("X.A", "X.B", "X.C"), "", fill = 100)
rel <- data.frame(c("A", "B", "C"),
c("AGG", "AGG", ""))

expect_equal(noC(toolAggregate(x, rel, dim = 1.2, partrel = TRUE)),
new.magpie(c("X.AGG", "X."), "", fill = c(200, 100)))

})