From 23c03578c2e7ce7369485d334511d444d725ecf9 Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Fri, 20 Sep 2024 16:00:00 +0200 Subject: [PATCH 1/3] revert --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/mipArea.R | 52 ++++++++++++++++++----------------------- R/showAreaAndBarPlots.R | 1 - README.md | 6 ++--- 6 files changed, 31 insertions(+), 38 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 86c250c..be34cf5 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '30175840' +ValidationKey: '29964000' 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 2eae0d9..427b2a3 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: 'mip: Comparison of multi-model runs' -version: 0.151.0 -date-released: '2024-09-18' +version: 0.149.3 +date-released: '2024-09-06' abstract: Package contains generic functions to produce comparison plots of multi-model runs. authors: diff --git a/DESCRIPTION b/DESCRIPTION index 56c41ae..dfc06d8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mip Title: Comparison of multi-model runs -Version: 0.151.0 -Date: 2024-09-18 +Version: 0.149.3 +Date: 2024-09-06 Authors@R: c( person("David", "Klein", , "dklein@pik-potsdam.de", role = c("aut", "cre")), person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = "aut"), diff --git a/R/mipArea.R b/R/mipArea.R index 4d4e5a9..72467f2 100644 --- a/R/mipArea.R +++ b/R/mipArea.R @@ -82,40 +82,34 @@ mipArea <- function(x, stack_priority = c("variable", "region"), total = TRUE, s ### ### Find out which variables to stack and which to put to facet_grid ### - if ("identifier" %in% names(x)) { - # if the identifier is specified externally, us that + region as facet and stack variables - facets <- c("identifier", "region") - if (!is.null(hist)) x <- rbind(x, hist) - dimToStack <- "variable" - } else { - # Identify stacking and facet_grid based on data - # count levels of the given columns - nLevels <- vapply(subset(x, select = c("variable", "region", "scenario", "model")), nlevels, integer(1)) - - # Find first dimension in stack_priority that has more than one element. - # Initialize dimToStack (this applies if if all dimensions have only one element) - dimToStack <- stack_priority[1] - for (s in stack_priority) { - if (nLevels[s] > 1) { - dimToStack <- s - break - } + + # count levels of the given columns + nLevels <- vapply(subset(x, select = c("variable", "region", "scenario", "model")), nlevels, integer(1)) + + # Find first dimension in stack_priority that has more than one element. + # Initialize dimToStack (this applies if if all dimensions have only one element) + dimToStack <- stack_priority[1] + for (s in stack_priority) { + if (nLevels[s] > 1) { + dimToStack <- s + break } + } - # find and sort dimension with more than one element, exclude dimToStack - # sort: to be able to build the interaction with the smallest number of resulting combinations (further down) - facets <- sort(nLevels[nLevels > 1]) - facets <- setdiff(names(facets), dimToStack) + # find and sort dimension with more than one element, exclude dimToStack + # sort: to be able to build the interaction with the smallest number of resulting combinations (further down) + facets <- sort(nLevels[nLevels > 1]) + facets <- setdiff(names(facets), dimToStack) - # Combine data and historical data into one object - if (!is.null(hist)) x <- rbind(x, hist) + # Combine data and historical data into one object + if (!is.null(hist)) x <- rbind(x, hist) - # if there are three facet dimensions that have more than one element combine the two - # smallest ones into the first one to be able to create a 2-D facet_grid later on - if (length(facets) == 3) { - x[, facets[1]] <- paste(x[[facets[2]]], x[[facets[1]]]) - } + # if there are three facet dimensions that have more than one element combine the two + # smallest ones into the first one to be able to create a 2-D facet_grid later on + if (length(facets) == 3) { + x[, facets[1]] <- paste(x[[facets[2]]], x[[facets[1]]]) } + # if not provided by user calculate total by summing over dimToStack if (isTRUE(total)) { dimToGroup <- setdiff(c("model", "scenario", "region", "variable", "unit", "period"), dimToStack) diff --git a/R/showAreaAndBarPlots.R b/R/showAreaAndBarPlots.R index ccca9d3..3739476 100644 --- a/R/showAreaAndBarPlots.R +++ b/R/showAreaAndBarPlots.R @@ -172,7 +172,6 @@ showAreaAndBarPlots <- function( .data$region == .env$mainReg, .data$variable == .env$tot) %>% droplevels() - dMainTot$scenario <- dMainTot$identifier p1 <- p1 + geom_line( data = dMainTot, diff --git a/README.md b/README.md index 61fa2b1..2fd6fe8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Comparison of multi-model runs -R package **mip**, version **0.151.0** +R package **mip**, version **0.149.3** [![CRAN status](https://www.r-pkg.org/badges/version/mip)](https://cran.r-project.org/package=mip) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1158586.svg)](https://doi.org/10.5281/zenodo.1158586) [![R build status](https://github.com/pik-piam/mip/workflows/check/badge.svg)](https://github.com/pik-piam/mip/actions) [![codecov](https://codecov.io/gh/pik-piam/mip/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mip) [![r-universe](https://pik-piam.r-universe.dev/badges/mip)](https://pik-piam.r-universe.dev/builds) @@ -47,7 +47,7 @@ In case of questions / problems please contact David Klein , R package version 0.151.0, . +Klein D, Dietrich J, Baumstark L, Humpenoeder F, Stevanovic M, Wirth S, Führlich P, Richters O, Rüter T (2024). _mip: Comparison of multi-model runs_. doi:10.5281/zenodo.1158586 , R package version 0.149.3, . A BibTeX entry for LaTeX users is @@ -56,7 +56,7 @@ A BibTeX entry for LaTeX users is title = {mip: Comparison of multi-model runs}, author = {David Klein and Jan Philipp Dietrich and Lavinia Baumstark and Florian Humpenoeder and Miodrag Stevanovic and Stephen Wirth and Pascal Führlich and Oliver Richters and Tonn Rüter}, year = {2024}, - note = {R package version 0.151.0}, + note = {R package version 0.149.3}, url = {https://github.com/pik-piam/mip}, doi = {10.5281/zenodo.1158586}, } From 41fcdc41deaa80e3386cca5fc1627a0d81bf32ec Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Fri, 20 Sep 2024 19:57:57 +0200 Subject: [PATCH 2/3] revert PR111 --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index be34cf5..ebf4171 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '29964000' +ValidationKey: '29859084' 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 427b2a3..027136c 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: 'mip: Comparison of multi-model runs' -version: 0.149.3 -date-released: '2024-09-06' +version: 0.149.4 +date-released: '2024-09-20' abstract: Package contains generic functions to produce comparison plots of multi-model runs. authors: diff --git a/DESCRIPTION b/DESCRIPTION index dfc06d8..806dbc3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mip Title: Comparison of multi-model runs -Version: 0.149.3 -Date: 2024-09-06 +Version: 0.149.4 +Date: 2024-09-20 Authors@R: c( person("David", "Klein", , "dklein@pik-potsdam.de", role = c("aut", "cre")), person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = "aut"), diff --git a/README.md b/README.md index 2fd6fe8..ff44765 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Comparison of multi-model runs -R package **mip**, version **0.149.3** +R package **mip**, version **0.149.4** [![CRAN status](https://www.r-pkg.org/badges/version/mip)](https://cran.r-project.org/package=mip) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1158586.svg)](https://doi.org/10.5281/zenodo.1158586) [![R build status](https://github.com/pik-piam/mip/workflows/check/badge.svg)](https://github.com/pik-piam/mip/actions) [![codecov](https://codecov.io/gh/pik-piam/mip/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mip) [![r-universe](https://pik-piam.r-universe.dev/badges/mip)](https://pik-piam.r-universe.dev/builds) @@ -47,7 +47,7 @@ In case of questions / problems please contact David Klein , R package version 0.149.3, . +Klein D, Dietrich J, Baumstark L, Humpenoeder F, Stevanovic M, Wirth S, Führlich P, Richters O, Rüter T (2024). _mip: Comparison of multi-model runs_. doi:10.5281/zenodo.1158586 , R package version 0.149.4, . A BibTeX entry for LaTeX users is @@ -56,7 +56,7 @@ A BibTeX entry for LaTeX users is title = {mip: Comparison of multi-model runs}, author = {David Klein and Jan Philipp Dietrich and Lavinia Baumstark and Florian Humpenoeder and Miodrag Stevanovic and Stephen Wirth and Pascal Führlich and Oliver Richters and Tonn Rüter}, year = {2024}, - note = {R package version 0.149.3}, + note = {R package version 0.149.4}, url = {https://github.com/pik-piam/mip}, doi = {10.5281/zenodo.1158586}, } From 2d6b1847b6a8fcfaa448e2040392a29d541539e7 Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Mon, 23 Sep 2024 15:57:17 +0200 Subject: [PATCH 3/3] revert PR111 --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index ebf4171..41420f7 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '29859084' +ValidationKey: '30203379' 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 027136c..178206e 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: 'mip: Comparison of multi-model runs' -version: 0.149.4 -date-released: '2024-09-20' +version: 0.151.1 +date-released: '2024-09-23' abstract: Package contains generic functions to produce comparison plots of multi-model runs. authors: diff --git a/DESCRIPTION b/DESCRIPTION index 806dbc3..784d24f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mip Title: Comparison of multi-model runs -Version: 0.149.4 -Date: 2024-09-20 +Version: 0.151.1 +Date: 2024-09-23 Authors@R: c( person("David", "Klein", , "dklein@pik-potsdam.de", role = c("aut", "cre")), person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = "aut"), diff --git a/README.md b/README.md index ff44765..d3d8a19 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Comparison of multi-model runs -R package **mip**, version **0.149.4** +R package **mip**, version **0.151.1** [![CRAN status](https://www.r-pkg.org/badges/version/mip)](https://cran.r-project.org/package=mip) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1158586.svg)](https://doi.org/10.5281/zenodo.1158586) [![R build status](https://github.com/pik-piam/mip/workflows/check/badge.svg)](https://github.com/pik-piam/mip/actions) [![codecov](https://codecov.io/gh/pik-piam/mip/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mip) [![r-universe](https://pik-piam.r-universe.dev/badges/mip)](https://pik-piam.r-universe.dev/builds) @@ -47,7 +47,7 @@ In case of questions / problems please contact David Klein , R package version 0.149.4, . +Klein D, Dietrich J, Baumstark L, Humpenoeder F, Stevanovic M, Wirth S, Führlich P, Richters O, Rüter T (2024). _mip: Comparison of multi-model runs_. doi:10.5281/zenodo.1158586 , R package version 0.151.1, . A BibTeX entry for LaTeX users is @@ -56,7 +56,7 @@ A BibTeX entry for LaTeX users is title = {mip: Comparison of multi-model runs}, author = {David Klein and Jan Philipp Dietrich and Lavinia Baumstark and Florian Humpenoeder and Miodrag Stevanovic and Stephen Wirth and Pascal Führlich and Oliver Richters and Tonn Rüter}, year = {2024}, - note = {R package version 0.149.4}, + note = {R package version 0.151.1}, url = {https://github.com/pik-piam/mip}, doi = {10.5281/zenodo.1158586}, }