From c16ee01a855d1c15b1f10b46ec3ede1619a0c2e8 Mon Sep 17 00:00:00 2001 From: Johannes Koch Date: Fri, 2 Aug 2024 14:06:59 +0200 Subject: [PATCH 1/2] Document toolGetUnitDollar --- NAMESPACE | 1 + R/toolGetUnitDollar.R | 21 ++++++++++++++++++--- man/toolGetUnitDollar.Rd | 25 +++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 man/toolGetUnitDollar.Rd diff --git a/NAMESPACE b/NAMESPACE index db7a9fb..1662d1d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand export(toolGetScenarioDefinition) +export(toolGetUnitDollar) exportPattern("^((calc(GDP|GDPpc|Population|Labour|Urban)(Past|Future|$))|read|download)") import(madrat) import(magclass) diff --git a/R/toolGetUnitDollar.R b/R/toolGetUnitDollar.R index 6de2651..9bad885 100644 --- a/R/toolGetUnitDollar.R +++ b/R/toolGetUnitDollar.R @@ -1,8 +1,23 @@ -toolGetUnitDollar <- function(returnOnlyBase = FALSE, inPPPP = FALSE) { - base <- 2017 +#' Get monetary unit +#' +#' toolGetUnitDollar returns unit used for monetary values. +#' +#' @param returnOnlyBase TRUE or FALSE (default). If true only the base year is returned (as string). +#' @param inPPP TRUE or FALSE (default). If TRUE the the string ends in 'Int$PPP', instead of 'Int$MER'. +#' +#' @return A string with the monetary unit: 'constant 2017 US$MER'. +#' @export +#' +#' @examples +#' toolGetUnitDollar() +#' toolGetUnitDollar(inPPP = TRUE) +#' toolGetUnitDollar(returnOnlyBase = TRUE) +#' +toolGetUnitDollar <- function(returnOnlyBase = FALSE, inPPP = FALSE) { + base <- "2017" if (returnOnlyBase) { return(base) } - pppOrMer <- if (inPPPP) "Int$PPP" else "US$MER" + pppOrMer <- if (inPPP) "Int$PPP" else "US$MER" paste("constant", base, pppOrMer) } diff --git a/man/toolGetUnitDollar.Rd b/man/toolGetUnitDollar.Rd new file mode 100644 index 0000000..24c2059 --- /dev/null +++ b/man/toolGetUnitDollar.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/toolGetUnitDollar.R +\name{toolGetUnitDollar} +\alias{toolGetUnitDollar} +\title{Get unit used for monetary values} +\usage{ +toolGetUnitDollar(returnOnlyBase = FALSE, inPPP = FALSE) +} +\arguments{ +\item{returnOnlyBase}{TRUE or FALSE (default). If true only the base year is returned (as string).} + +\item{inPPP}{TRUE or FALSE (default). If TRUE the the string ends in 'Int$PPP', instead of 'Int$MER'.} +} +\value{ +A string with the unit used for monetary values: 'constant 2017 US$MER'. +} +\description{ +toolGetUnitDollar returns the unit used for monetary values. +} +\examples{ +toolGetUnitDollar() +toolGetUnitDollar(inPPP = TRUE) +toolGetUnitDollar(returnOnlyBase = TRUE) + +} From aed592c25f4b91893e2395ee5b5aa3a8d4cb0667 Mon Sep 17 00:00:00 2001 From: Johannes Koch Date: Fri, 2 Aug 2024 14:16:47 +0200 Subject: [PATCH 2/2] Bump version --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 882207c..eed2e03 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '4027072' +ValidationKey: '4047211' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 9ff3390..e2e7a42 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: 2.0.2 -date-released: '2024-08-01' +version: 2.0.3 +date-released: '2024-08-02' 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 0e1580a..9a3dbda 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mrdrivers Type: Package Title: Create GDP and Population Scenarios -Version: 2.0.2 +Version: 2.0.3 Authors@R: c(person(given = "Johannes", family = "Koch", email = "jokoch@pik-potsdam.de", @@ -48,6 +48,6 @@ Suggests: Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 -Date: 2024-08-01 +Date: 2024-08-02 Config/testthat/edition: 3 VignetteBuilder: knitr diff --git a/README.md b/README.md index 378bf4b..aff5c2c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Create GDP and Population Scenarios -R package **mrdrivers**, version **2.0.2** +R package **mrdrivers**, version **2.0.3** [![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) @@ -103,7 +103,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 2.0.3, . A BibTeX entry for LaTeX users is @@ -112,7 +112,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 2.0.2}, + note = {R package version 2.0.3}, url = {https://pik-piam.github.io/mrdrivers}, url = {https://github.com/pik-piam/mrdrivers}, }