diff --git a/.buildlibrary b/.buildlibrary index e4058f39d..52e75a45e 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '5227948' +ValidationKey: '5252636' AutocreateReadme: yes allowLinterWarnings: no AddInReadme: tutorial.md diff --git a/CITATION.cff b/CITATION.cff index e8060304f..689ad418d 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: 'piamInterfaces: Project specific interfaces to REMIND / MAgPIE' -version: 0.26.2 -date-released: '2024-08-19' +version: 0.26.3 +date-released: '2024-09-06' abstract: Project specific interfaces to REMIND / MAgPIE. authors: - family-names: Benke diff --git a/DESCRIPTION b/DESCRIPTION index a5d8725fc..6b670c75c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: piamInterfaces Title: Project specific interfaces to REMIND / MAgPIE -Version: 0.26.2 -Date: 2024-08-19 +Version: 0.26.3 +Date: 2024-09-06 Authors@R: c( person("Falk", "Benke", , "benke@pik-potsdam.de", role = c("aut", "cre")), person("Oliver", "Richters", role = "aut") @@ -14,7 +14,7 @@ Imports: dplyr (>= 1.1.1), gms, magclass, - mip (>= 0.144.3), + mip (>= 0.149.3), readxl, quitte (>= 0.3137.1), piamutils (>= 0.0.12), diff --git a/R/checkSummations.R b/R/checkSummations.R index afdeb0750..e55459f7e 100644 --- a/R/checkSummations.R +++ b/R/checkSummations.R @@ -51,7 +51,7 @@ checkSummations <- function(mifFile, outputDirectory = ".", template = NULL, sum summationsFile <- chooseFromList(summationsOptions, multiple = FALSE, type = "summation file") } if (isTRUE(summationsFile == "extractVariableGroups")) { - checkVariables <- extractVariableGroups(levels(data$variable), keepOrigNames = TRUE) + checkVariables <- extractVariableGroups(levels(data$variable), keepOrigNames = TRUE, sorted = TRUE) names(checkVariables) <- make.unique(names(checkVariables), sep = " ") } else { summationGroups <- getSummations(summationsFile) diff --git a/README.md b/README.md index 645471bbf..66da33555 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Project specific interfaces to REMIND / MAgPIE -R package **piamInterfaces**, version **0.26.2** +R package **piamInterfaces**, version **0.26.3** [![CRAN status](https://www.r-pkg.org/badges/version/piamInterfaces)](https://cran.r-project.org/package=piamInterfaces) [![R build status](https://github.com/pik-piam/piamInterfaces/workflows/check/badge.svg)](https://github.com/pik-piam/piamInterfaces/actions) [![codecov](https://codecov.io/gh/pik-piam/piamInterfaces/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/piamInterfaces) [![r-universe](https://pik-piam.r-universe.dev/badges/piamInterfaces)](https://pik-piam.r-universe.dev/builds) @@ -107,7 +107,7 @@ In case of questions / problems please contact Falk Benke To cite package **piamInterfaces** in publications use: -Benke F, Richters O (2024). _piamInterfaces: Project specific interfaces to REMIND / MAgPIE_. R package version 0.26.2, . +Benke F, Richters O (2024). _piamInterfaces: Project specific interfaces to REMIND / MAgPIE_. R package version 0.26.3, . A BibTeX entry for LaTeX users is @@ -116,7 +116,7 @@ A BibTeX entry for LaTeX users is title = {piamInterfaces: Project specific interfaces to REMIND / MAgPIE}, author = {Falk Benke and Oliver Richters}, year = {2024}, - note = {R package version 0.26.2}, + note = {R package version 0.26.3}, url = {https://github.com/pik-piam/piamInterfaces}, } ``` diff --git a/tests/testthat/test-getMapping.R b/tests/testthat/test-getMapping.R index 884294fd8..2ccf4ac87 100644 --- a/tests/testthat/test-getMapping.R +++ b/tests/testthat/test-getMapping.R @@ -15,6 +15,19 @@ for (mapping in names(mappingNames())) { } expect_true(length(conflictsigns) == 0, label = paste0(mapping, " has no merge conflicts")) + # check whether piam_factor column has , as decimal separator + factorWithComma <- mappingData %>% + filter(grepl(",", .data$piam_factor)) %>% + pull("variable") + if (length(factorWithComma) > 0) { + warning("These variables in mapping ", mapping, " have a piam_factor using a ',' as decimal. Please use '.':\n", + paste(factorWithComma, collapse = "\n"), + "\nYou can run: devtools::load_all(); write.csv2(getMapping('", mapping, + "') %>% mutate(piam_factor = gsub(',', '.', .data$piam_factor)), mappingNames('", mapping, + "'), na = '', row.names = FALSE, quote = FALSE)") + } + expect_true(length(factorWithComma) == 0) + # look for Moving Avg prices in REMIND variables movingavg <- mappingData %>% filter(grepl("^Price\\|.*\\|Moving Avg", .data$piam_variable), @@ -90,19 +103,6 @@ for (mapping in names(mappingNames())) { } expect_true(length(factorWithoutVar) == 0) - # check whether piam_factor column has , as decimal separator - factorWithComma <- mappingData %>% - filter(grepl(",", .data$piam_factor)) %>% - pull("variable") - if (length(factorWithComma) > 0) { - warning("These variables in mapping ", mapping, " have a piam_factor using a ',' as decimal. Please use '.':\n", - paste(factorWithComma, collapse = "\n"), - "\nYou can run: devtools::load_all(); write.csv2(getMapping('", mapping, - "') %>% mutate(piam_factor = gsub(',', '.', .data$piam_factor)), mappingNames('", mapping, - "'), na = '', row.names = FALSE, quote = FALSE)") - } - expect_true(length(factorWithComma) == 0) - # checks only if source is supplied if ("source" %in% colnames(mappingData)) { # check for empty piam_variable with source