diff --git a/.buildlibrary b/.buildlibrary index 4d76417..0c4db78 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '8013200' +ValidationKey: '8033634' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 4460715..cabbe42 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: 4.0.0 -date-released: '2024-11-06' +version: 4.0.1 +date-released: '2024-11-07' 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 9c232b5..58dafe6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mrdrivers Type: Package Title: Create GDP and Population Scenarios -Version: 4.0.0 +Version: 4.0.1 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: 2024-11-06 +Date: 2024-11-07 Config/testthat/edition: 3 VignetteBuilder: knitr diff --git a/R/calcGDPPast.R b/R/calcGDPPast.R index 3792da3..406fbb1 100644 --- a/R/calcGDPPast.R +++ b/R/calcGDPPast.R @@ -34,9 +34,11 @@ calcGDPPast <- function(pastData = "WDI-MI-James", extension1960 = "MI-James") { aggregate = FALSE, supplementary = TRUE) data <- toolHarmonizeFuture(past = data1960, future = data, method = "growth") - data$x <- toolInterpolateAndExtrapolate(data$x) } + # Fill in trailing zeros with closest value + data$x <- toolInterpolateAndExtrapolate(data$x) + list(x = data$x, weight = NULL, unit = glue("mil. {toolGetUnitDollar(inPPP = TRUE)}"), diff --git a/R/calcPopulationPast.R b/R/calcPopulationPast.R index 69dfbcb..011102c 100644 --- a/R/calcPopulationPast.R +++ b/R/calcPopulationPast.R @@ -4,9 +4,13 @@ calcPopulationPast <- function(pastData = "WDI-UN_PopDiv-MI") { toolCheckUserInput("PopulationPast", as.list(environment())) # Call calcInternalPopulationPast function the appropriate number of times (map) and combine (reduce) # !! Keep formula syntax for madrat caching to work - purrr::pmap(list("pastData" = unlist(strsplit(pastData, "-"))), - ~calcOutput("InternalPopulationPast", aggregate = FALSE, supplementary = TRUE, ...)) %>% + data <- purrr::pmap(list("pastData" = unlist(strsplit(pastData, "-"))), + ~calcOutput("InternalPopulationPast", aggregate = FALSE, supplementary = TRUE, ...)) %>% toolListFillWith() + + # Fill in trailing zeros with closest value + data$x <- toolInterpolateAndExtrapolate(data$x) + data } calcInternalPopulationPast <- function(pastData) { diff --git a/README.md b/README.md index 03d79ce..58fde0f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Create GDP and Population Scenarios -R package **mrdrivers**, version **4.0.0** +R package **mrdrivers**, version **4.0.1** [![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 (2024). _mrdrivers: Create GDP and Population Scenarios_. R package version 4.0.1, . A BibTeX entry for LaTeX users is @@ -109,7 +109,7 @@ A BibTeX entry for LaTeX users is title = {mrdrivers: Create GDP and Population Scenarios}, author = {Johannes Koch and Bjoern Soergel and Deborra Leip and Falk Benke and Jan Philipp Dietrich}, year = {2024}, - note = {R package version 4.0.0}, + note = {R package version 4.0.1}, url = {https://pik-piam.github.io/mrdrivers}, url = {https://github.com/pik-piam/mrdrivers}, }