Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document toolGetUnitDollar #87

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '4027072'
ValidationKey: '4047211'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]",
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
21 changes: 18 additions & 3 deletions R/toolGetUnitDollar.R
Original file line number Diff line number Diff line change
@@ -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)
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -103,7 +103,7 @@ In case of questions / problems please contact Johannes Koch <jokoch@pik-potsdam

To cite package **mrdrivers** in publications use:

Koch J, Soergel B, Leip D, Benke F, Dietrich J (2024). _mrdrivers: Create GDP and Population Scenarios_. R package version 2.0.2, <https://pik-piam.github.io/mrdrivershttps://github.com/pik-piam/mrdrivers>.
Koch J, Soergel B, Leip D, Benke F, Dietrich J (2024). _mrdrivers: Create GDP and Population Scenarios_. R package version 2.0.3, <https://pik-piam.github.io/mrdrivershttps://github.com/pik-piam/mrdrivers>.

A BibTeX entry for LaTeX users is

Expand All @@ -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},
}
Expand Down
25 changes: 25 additions & 0 deletions man/toolGetUnitDollar.Rd

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

Loading