From d7a375d2d942f3fb3e37d2da09245953c2a54a9c Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Tue, 16 May 2023 17:50:01 +0200 Subject: [PATCH] fix bug in compareData.R --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/compareData.R | 6 ++++-- README.md | 6 +++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index c5ddd346..4bd5acff 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '6469352' +ValidationKey: '6491169' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index 10b24416..0a55c112 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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.3.2 -date-released: '2023-05-09' +version: 3.3.3 +date-released: '2023-05-16' 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 diff --git a/DESCRIPTION b/DESCRIPTION index b87ce06e..40e61b4d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: madrat Title: May All Data be Reproducible and Transparent (MADRaT) * -Version: 3.3.2 -Date: 2023-05-09 +Version: 3.3.3 +Date: 2023-05-16 Authors@R: c( person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = c("aut", "cre")), person("Lavinia", "Baumstark", , "lavinia@pik-potsdam.de", role = "aut"), diff --git a/R/compareData.R b/R/compareData.R index 2138946b..1a65a743 100644 --- a/R/compareData.R +++ b/R/compareData.R @@ -69,7 +69,7 @@ compareData <- function(x, y, tolerance = 10^-5, yearLim = NULL) { message("!= dimnames") out$diff <- out$diff + 1 } else { - diff <- max(abs(x - y)) + diff <- max(abs(x - y), na.rm = TRUE) if (!identical(x, y) && diff > tolerance) { message("!= values (max diff = ", round(diff, 8), ")") out$diff <- out$diff + 1 @@ -85,7 +85,9 @@ compareData <- function(x, y, tolerance = 10^-5, yearLim = NULL) { .rmag <- function(f, yearLim) { x <- try(read.magpie(f), silent = TRUE) - if (!is.magpie(x)) return(NULL) else { + if (!is.magpie(x)) { + return(NULL) + } else { if (!is.null(yearLim)) x <- x[, getYears(x, as.integer = TRUE) <= yearLim, ] } attr(x, "comment") <- NULL diff --git a/README.md b/README.md index 2e8834e9..ccfd3a72 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # May All Data be Reproducible and Transparent (MADRaT) * -R package **madrat**, version **3.3.2** +R package **madrat**, version **3.3.3** [![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) @@ -55,7 +55,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 3.3.2, . +Dietrich J, Baumstark L, Wirth S, Giannousakis A, Rodrigues R, Bodirsky B, Kreidenweis U, Klein D, Führlich P (2023). _madrat: May All Data be Reproducible and Transparent (MADRaT)_. doi:10.5281/zenodo.1115490 , R package version 3.3.3, . A BibTeX entry for LaTeX users is @@ -64,7 +64,7 @@ A BibTeX entry for LaTeX users is title = {madrat: May All Data be Reproducible and Transparent (MADRaT)}, author = {Jan Philipp Dietrich and Lavinia Baumstark and Stephen Wirth and Anastasis Giannousakis and Renato Rodrigues and Benjamin Leon Bodirsky and Ulrich Kreidenweis and David Klein and Pascal Führlich}, year = {2023}, - note = {R package version 3.3.2}, + note = {R package version 3.3.3}, doi = {10.5281/zenodo.1115490}, url = {https://github.com/pik-piam/madrat}, }