Skip to content

Commit

Permalink
Merge pull request magpiemodel#35 from orichters/smallfix
Browse files Browse the repository at this point in the history
checkSummations happy to get passed quitte object
  • Loading branch information
orichters committed Nov 18, 2022
2 parents e398db0 + a5a3102 commit d5b6e6a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ValidationKey: '501982'
ValidationKey: '521478'
AutocreateReadme: yes
allowLinterWarnings: no
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "piamInterfaces: Project specific interfaces to REMIND / MAgPIE",
"version": "0.0.26",
"version": "0.0.27",
"description": "<p>Project specific interfaces to REMIND / MAgPIE.<\/p>",
"creators": [
{
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: piamInterfaces
Title: Project specific interfaces to REMIND / MAgPIE
Version: 0.0.26
Date: 2022-11-11
Version: 0.0.27
Date: 2022-11-18
Authors@R: c(
person("Falk", "Benke", , "benke@pik-potsdam.de", role = c("aut", "cre")),
person("Oliver", "Richters", role = "aut")
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ importFrom(magclass,mbind)
importFrom(magclass,read.report)
importFrom(magclass,unitsplit)
importFrom(magclass,write.report)
importFrom(quitte,as.quitte)
importFrom(quitte,read.quitte)
importFrom(quitte,write.mif)
importFrom(readxl,read_excel)
Expand Down
6 changes: 3 additions & 3 deletions R/checkSummations.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @md
#' @author Falk Benke, Oliver Richters
#' @param mifFile path to the mif file to apply summation checks to
#' @param mifFile path to the mif file to apply summation checks to, or quitte object
#' @param dataDumpFile file where data.frame with the data analysis is saved. If NULL, result is returned
#' @param outputDirectory path to directory to place logFile and dataDumpFile
#' @param logFile file where human-readable summary is saved. If NULL, write to stdout
Expand All @@ -11,11 +11,11 @@
#' @param template mapping template to be loaded
#' @param remindVar REMIND/MAgPIE variable column name in template
#' @importFrom dplyr group_by summarise ungroup left_join mutate arrange %>% filter select desc
#' @importFrom quitte read.quitte
#' @importFrom magclass unitsplit
#' @importFrom rlang sym syms
#' @importFrom utils write.table
#' @importFrom stringr str_pad
#' @importFrom quitte as.quitte
#'
#' @export
checkSummations <- function(mifFile, outputDirectory = ".", template = "AR6", summationsFile = "AR6",
Expand All @@ -39,7 +39,7 @@ checkSummations <- function(mifFile, outputDirectory = ".", template = "AR6", su
summationsFile <- gsub(".*piamInterfaces", "piamInterfaces", summationsNames(summationsFile))
}

data <- read.quitte(mifFile) %>%
data <- quitte::as.quitte(mifFile) %>%
filter(!!sym("variable") %in% unique(c(summationGroups$child, summationGroups$parent))) %>%
left_join(summationGroups, by = c("variable" = "child"))

Expand Down
3 changes: 2 additions & 1 deletion R/variableInfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ variableInfo <- function(varname, mif = NULL, template = NULL, remindVar = "piam
allremindchilds <- setdiff(allremindchilds, remindchilds)
}
for (ch in allremindchilds) {
exportchild <- unique(unitsplit(templateData$Variable[unitsplit(templateData[, remindVar])$variable == ch])$variable)
exportchild <- unique(unitsplit(
templateData$Variable[unitsplit(templateData[, remindVar])$variable == ch])$variable)
exportchild <- exportchild[! is.na(exportchild)]
message(" . ", str_pad(paste(exportchild, collapse = ", "), width, "right"), " . ", ch)
}
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.0.26**
R package **piamInterfaces**, version **0.0.27**

[![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/piam_interfaces/workflows/check/badge.svg)](https://github.com/pik-piam/piam_interfaces/actions) [![codecov](https://codecov.io/gh/pik-piam/piam_interfaces/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/piam_interfaces) [![r-universe](https://pik-piam.r-universe.dev/badges/piamInterfaces)](https://pik-piam.r-universe.dev/ui#builds)

Expand Down Expand Up @@ -38,7 +38,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 (2022). _piamInterfaces: Project specific interfaces to REMIND / MAgPIE_. R package version 0.0.26, <URL: https://github.com/pik-piam/piam_interfaces>.
Benke F, Richters O (2022). _piamInterfaces: Project specific interfaces to REMIND / MAgPIE_. R package version 0.0.27, <URL: https://github.com/pik-piam/piam_interfaces>.

A BibTeX entry for LaTeX users is

Expand All @@ -47,7 +47,7 @@ A BibTeX entry for LaTeX users is
title = {piamInterfaces: Project specific interfaces to REMIND / MAgPIE},
author = {Falk Benke and Oliver Richters},
year = {2022},
note = {R package version 0.0.26},
note = {R package version 0.0.27},
url = {https://github.com/pik-piam/piam_interfaces},
}
```
2 changes: 1 addition & 1 deletion man/checkSummations.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d5b6e6a

Please sign in to comment.