Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort extractVariableGroups; put decimal test first #363

Merged
merged 2 commits into from
Sep 6, 2024
Merged
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: '5227948'
ValidationKey: '5252636'
AutocreateReadme: yes
allowLinterWarnings: no
AddInReadme: tutorial.md
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: '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
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion R/checkSummations.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -107,7 +107,7 @@ In case of questions / problems please contact Falk Benke <benke@pik-potsdam.de>

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, <https://github.com/pik-piam/piamInterfaces>.
Benke F, Richters O (2024). _piamInterfaces: Project specific interfaces to REMIND / MAgPIE_. R package version 0.26.3, <https://github.com/pik-piam/piamInterfaces>.

A BibTeX entry for LaTeX users is

Expand All @@ -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},
}
```
26 changes: 13 additions & 13 deletions tests/testthat/test-getMapping.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down