diff --git a/.buildlibrary b/.buildlibrary index b57220b..1257866 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '10057500' +ValidationKey: '12069600' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index f3e8686..c6b5b6e 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: 'mrdrivers: Create GDP and Population Scenarios' -version: 5.0.0 -date-released: '2025-01-27' +version: 6.0.0 +date-released: '2025-01-28' abstract: Create GDP and population scenarios This package constructs the GDP and population scenarios used as drivers in both the REMIND and MAgPIE models. authors: diff --git a/DESCRIPTION b/DESCRIPTION index 23d5ae0..e241edf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mrdrivers Type: Package Title: Create GDP and Population Scenarios -Version: 5.0.0 +Version: 6.0.0 Authors@R: c(person(given = "Johannes", family = "Koch", email = "jokoch@pik-potsdam.de", @@ -44,6 +44,6 @@ Suggests: Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 -Date: 2025-01-27 +Date: 2025-01-28 Config/testthat/edition: 3 VignetteBuilder: knitr diff --git a/R/calcRatioPPP2MER.R b/R/calcRatioPPP2MER.R deleted file mode 100644 index 0f4f5d1..0000000 --- a/R/calcRatioPPP2MER.R +++ /dev/null @@ -1,31 +0,0 @@ -#' MER over PPP ratio -#' -#' Get a conversion factor to convert GDP in constant 2017 Int$PPP into constant 2017 US$MER. -#' Use the "when" argument to switch the year of the conversion factor. Source = WDI. Countries with missing data are -#' filled in with 1. Regional aggregation is weighed by GDP from WDI-MI in the year set by "when". -#' -#' @param when An integer (defaults to 2017) specifying the year of the PPP2MER factor. -#' @inherit madrat::calcOutput return -#' @seealso [madrat::calcOutput()] -#' @examples \dontrun{ -#' calcOutput("RatioPPP2MER") -#' } -#' -calcRatioPPP2MER <- function(when = 2017) { - - data <- readSource("WDI", "PA.NUS.PPPC.RF")[, when, ] - # Replace 0s with 1s. This was done previously. Other solutions here should be taken into consideration. - data[data == 0] <- 1 - # Set names and years to NULL, for GAMS interface to work. - getNames(data) <- NULL - getYears(data) <- NULL - - weight <- calcOutput("GDPPast", aggregate = FALSE, years = when) - - list(x = data, - weight = weight, - unit = glue::glue("constant {when} US$MER / constant {when} Int$PPP"), - description = glue::glue("Ratio of GDP in constant {when} US$MER over GDP in constant {when} Int$PPP (source: \\ - WDI). Can be used to convert between GDP at constant {when} Int$PPP and GDP at \\ - constant {when} US$MER.")) -} diff --git a/README.md b/README.md index 4b7622e..ce36a9a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Create GDP and Population Scenarios -R package **mrdrivers**, version **5.0.0** +R package **mrdrivers**, version **6.0.0** [![CRAN status](https://www.r-pkg.org/badges/version/mrdrivers)](https://cran.r-project.org/package=mrdrivers) [![R build status](https://pik-piam.github.io/mrdrivers/workflows/check/badge.svg)](https://pik-piam.github.io/mrdrivers/actions) [![codecov](https://codecov.io/gh/mrdrivers/branch/master/graph/badge.svg)](https://app.codecov.io/gh/mrdrivers) [![r-universe](https://pik-piam.r-universe.dev/badges/mrdrivers)](https://pik-piam.r-universe.dev/builds) @@ -100,7 +100,7 @@ In case of questions / problems please contact Johannes Koch . +Koch J, Soergel B, Leip D, Benke F, Dietrich J (2025). "mrdrivers: Create GDP and Population Scenarios." Version: 6.0.0, . A BibTeX entry for LaTeX users is @@ -108,10 +108,10 @@ A BibTeX entry for LaTeX users is @Misc{, title = {mrdrivers: Create GDP and Population Scenarios}, author = {Johannes Koch and Bjoern Soergel and Deborra Leip and Falk Benke and Jan Philipp Dietrich}, - date = {2025-01-27}, + date = {2025-01-28}, year = {2025}, url = {https://pik-piam.github.io/mrdrivers}, url = {https://github.com/pik-piam/mrdrivers}, - note = {Version: 5.0.0}, + note = {Version: 6.0.0}, } ``` diff --git a/man/calcRatioPPP2MER.Rd b/man/calcRatioPPP2MER.Rd deleted file mode 100644 index 3b19ac6..0000000 --- a/man/calcRatioPPP2MER.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/calcRatioPPP2MER.R -\name{calcRatioPPP2MER} -\alias{calcRatioPPP2MER} -\title{MER over PPP ratio} -\usage{ -calcRatioPPP2MER(when = 2017) -} -\arguments{ -\item{when}{An integer (defaults to 2017) specifying the year of the PPP2MER factor.} -} -\value{ -magpie object with the requested output data either on country or on -regional level depending on the choice of argument "aggregate" or a list of information -if supplementary is set to TRUE. -} -\description{ -Get a conversion factor to convert GDP in constant 2017 Int$PPP into constant 2017 US$MER. -Use the "when" argument to switch the year of the conversion factor. Source = WDI. Countries with missing data are -filled in with 1. Regional aggregation is weighed by GDP from WDI-MI in the year set by "when". -} -\examples{ -\dontrun{ -calcOutput("RatioPPP2MER") -} - -} -\seealso{ -\code{\link[madrat:calcOutput]{madrat::calcOutput()}} -} diff --git a/tests/testthat/test-03-calcOutput_sets.R b/tests/testthat/test-03-calcOutput_sets.R index 1f6576e..f9302db 100644 --- a/tests/testthat/test-03-calcOutput_sets.R +++ b/tests/testthat/test-03-calcOutput_sets.R @@ -29,7 +29,6 @@ test_that("set names", { expectCorrectSetNames(calcOutput("GDPpcFuture")) expectCorrectSetNames(calcOutput("GDP", extension2150 = "none")) expectCorrectSetNames(calcOutput("GDPpc", extension2150 = "none")) - # Want to keep: expectCorrectSetNames(calcOutput("RatioPPP2MER")) }) @@ -184,22 +183,3 @@ test_that("GDPpc factored by its weight is equal to GDP, in MER", { comment(y) <- NULL expect_equal(x, y) }) - -test_that("ppp2mer is consistent with GDP in PPP and MER", { - gdp1 <- calcOutput("GDP", unit = "constant 2017 US$MER", aggregate = FALSE) - gdp2 <- calcOutput("GDP", unit = "constant 2017 Int$PPP", aggregate = FALSE) - ppp2merDef <- calcOutput("RatioPPP2MER", aggregate = FALSE) - - diff <- gdp1 / gdp2 - ppp2merDef - - expect_lt(max(diff), 1e-12) - - # On regional level - gdp1 <- calcOutput("GDP", unit = "constant 2017 US$MER") - gdp2 <- calcOutput("GDP", unit = "constant 2017 Int$PPP") - ppp2merDef <- calcOutput("RatioPPP2MER") - - diff <- gdp1 / gdp2 - ppp2merDef - - expect_lt(max(diff[, 2020, ]), 1e-2) -}) diff --git a/tests/testthat/test-09-snaphsots.R b/tests/testthat/test-09-snaphsots.R index 4e572d3..26fe024 100644 --- a/tests/testthat/test-09-snaphsots.R +++ b/tests/testthat/test-09-snaphsots.R @@ -37,7 +37,3 @@ test_that("Default calcOutput Urban calls", { test_that("Default calcOutput Labour calls", { expect_snapshot_value(fh(calcOutput("Labour")), style = "json2") }) - -test_that("Default calcOutput RatioPPP2MER call", { - expect_snapshot_value(calcOutput("RatioPPP2MER"), style = "json2") -})