From fb69d41d00f7c9f2a0787723c7c103c649eb6ec5 Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Mon, 22 Jul 2024 15:46:59 +0200 Subject: [PATCH] removed usage of expand.set --- .buildlibrary | 2 +- CITATION.cff | 2 +- DESCRIPTION | 2 +- NAMESPACE | 1 - R/trade.R | 3 +-- R/water_usage.R | 18 +++++------------- README.md | 6 +++--- 7 files changed, 12 insertions(+), 22 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 6528094..4df282c 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '5380020' +ValidationKey: '5399946' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index e673da0..4cf1d4f 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,7 +2,7 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'magpie4: MAgPIE outputs R package for MAgPIE version 4.x' -version: 2.7.0 +version: 2.7.1 date-released: '2024-07-22' abstract: Common output routines for extracting results from the MAgPIE framework (versions 4.x). diff --git a/DESCRIPTION b/DESCRIPTION index 02c3a5b..34d89c2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: magpie4 Title: MAgPIE outputs R package for MAgPIE version 4.x -Version: 2.7.0 +Version: 2.7.1 Date: 2024-07-22 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), diff --git a/NAMESPACE b/NAMESPACE index ceb72c9..a37303a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -298,7 +298,6 @@ importFrom(dplyr,mutate) importFrom(dplyr,pull) importFrom(dplyr,rename) importFrom(dplyr,select) -importFrom(gdx,expand.set) importFrom(gdx,readGDX) importFrom(gms,tardir) importFrom(luscale,superAggregate) diff --git a/R/trade.R b/R/trade.R index 0643c57..cf174a5 100644 --- a/R/trade.R +++ b/R/trade.R @@ -22,7 +22,6 @@ #' x <- trade(gdx="fulldata.gdx", level="regglo", products="kcr") #' } #' -#' @importFrom gdx expand.set trade <- function(gdx, file = NULL, level = "reg", products = "k_trade", product_aggr = FALSE, attributes = "dm", weight = FALSE, @@ -35,7 +34,7 @@ trade <- function(gdx, file = NULL, level = "reg", products = "k_trade", products <- try(readGDX(gdx, products)) if (is.null(products)){ - products <- expand.set(gdx, "kall") + products <- readGDX(gdx, "kall") warning("The specified commodity set in products argument does not exit. Instead the full kall set is given to products argument.") } diff --git a/R/water_usage.R b/R/water_usage.R index 0a97f8e..eb016cd 100644 --- a/R/water_usage.R +++ b/R/water_usage.R @@ -50,20 +50,12 @@ water_usage <- function(gdx, file = NULL, level = "reg", users = NULL, } if (is.null(users)) { - - users <- expand.set(gdx, - c(sectors, kcr, kli), - c(sectors, kcr, kli)) - + users <- c(sectors, kcr, kli) } else { - - if (users == "sectors") { - users <- sectors - } else { - users <- expand.set(gdx, - users, - c(sectors, kcr, kli)) - } + users <- NULL + if ("sectors" %in% users) users <- c(users, sectors) + if ("kcr" %in% users) users <- c(users, "kcr") + if ("kli" %in% users) users <- c(users, "kli") } user <- list() diff --git a/README.md b/README.md index fa2542a..d22170e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MAgPIE outputs R package for MAgPIE version 4.x -R package **magpie4**, version **2.7.0** +R package **magpie4**, version **2.7.1** [![CRAN status](https://www.r-pkg.org/badges/version/magpie4)](https://cran.r-project.org/package=magpie4) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1158582.svg)](https://doi.org/10.5281/zenodo.1158582) [![R build status](https://github.com/pik-piam/magpie4/workflows/check/badge.svg)](https://github.com/pik-piam/magpie4/actions) [![codecov](https://codecov.io/gh/pik-piam/magpie4/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/magpie4) [![r-universe](https://pik-piam.r-universe.dev/badges/magpie4)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Benjamin Leon Bodirsky . +Bodirsky B, Humpenoeder F, Dietrich J, Stevanovic M, Weindl I, Karstens K, Wang X, Mishra A, Beier F, Breier J, Yalew A, Chen D, Biewald A, Wirth S, von Jeetze P, Leip D, Crawford M, Alves M (2024). _magpie4: MAgPIE outputs R package for MAgPIE version 4.x_. doi: 10.5281/zenodo.1158582 (URL: https://doi.org/10.5281/zenodo.1158582), R package version 2.7.1, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is title = {magpie4: MAgPIE outputs R package for MAgPIE version 4.x}, author = {Benjamin Leon Bodirsky and Florian Humpenoeder and Jan Philipp Dietrich and Miodrag Stevanovic and Isabelle Weindl and Kristine Karstens and Xiaoxi Wang and Abhijeet Mishra and Felicitas Beier and Jannes Breier and Amsalu Woldie Yalew and David Chen and Anne Biewald and Stephen Wirth and Patrick {von Jeetze} and Debbora Leip and Michael Crawford and Marcos Alves}, year = {2024}, - note = {R package version 2.7.0}, + note = {R package version 2.7.1}, doi = {10.5281/zenodo.1158582}, url = {https://github.com/pik-piam/magpie4}, }