From 15956d35233d91a1df964a65ca41331f3d8fee48 Mon Sep 17 00:00:00 2001 From: Johannes Koch Date: Tue, 16 Apr 2024 12:35:54 +0200 Subject: [PATCH] Update README --- README.Rmd | 35 +++++++++++++++++++++++++++++++++-- README.md | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/README.Rmd b/README.Rmd index f5b9b0c..948417c 100644 --- a/README.Rmd +++ b/README.Rmd @@ -18,8 +18,9 @@ knitr::opts_chunk$set( -[![CRAN status](https://www.r-pkg.org/badges/version/GDPuc)](https://CRAN.R-project.org/package=GDPuc) [![R-CMD-check](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml) [![codecov](https://codecov.io/gh/pik-piam/GDPuc/branch/main/graph/badge.svg?token=3GHXFQXARX)](https://app.codecov.io/gh/pik-piam/GDPuc) ![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg) -[![R-CMD-check](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml) +[![CRAN status](https://www.r-pkg.org/badges/version/GDPuc)](https://CRAN.R-project.org/package=GDPuc) [![check](https://github.com/pik-piam/GDPuc/actions/workflows/check.yaml/badge.svg)](https://github.com/pik-piam/GDPuc/actions/workflows/check.yaml) +[![codecov](https://codecov.io/gh/pik-piam/GDPuc/branch/main/graph/badge.svg?token=3GHXFQXARX)](https://app.codecov.io/gh/pik-piam/GDPuc) +![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg) GDPuc (a.k.a. the GDP unit-converter) provides a simple function to convert GDP time-series data from one unit to another. @@ -71,6 +72,19 @@ The `unit_in` and `unit_out` arguments specify the incoming and outgoing GDP uni Here "YYYY" is a placeholder for a year, e.g. "2010" or "2015", and "LCU" stands for Local Currency Unit. +For a quick conversion of a single value use `convertSingle`. + +```{r usage2, eval=FALSE} +convertSingle( + x = 100, + iso3c = "FRA", + year = 2000, + unit_in = "current LCU", + unit_out = "constant 2017 Int$PPP" +) +``` + + ## Example ```{r example1} @@ -88,6 +102,23 @@ convertGDP( unit_in = "constant 2005 LCU", unit_out = "constant 2017 Int$PPP" ) + +convertSingle( + x = 100, + iso3c = "USA", + year = 2010, + unit_in = "current LCU", + unit_out = "constant 2017 Int$PPP" +) + +# When converting between constant currencies, the year of the GDP value is not important, +# and can be left out. +convertSingle( + x = 100, + iso3c = "USA", + unit_in = "constant 2005 LCU", + unit_out = "constant 2017 Int$PPP" +) ``` ## Further Options diff --git a/README.md b/README.md index 4b316ee..7fbb925 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,10 @@ [![CRAN status](https://www.r-pkg.org/badges/version/GDPuc)](https://CRAN.R-project.org/package=GDPuc) -[![R-CMD-check](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml) +[![check](https://github.com/pik-piam/GDPuc/actions/workflows/check.yaml/badge.svg)](https://github.com/pik-piam/GDPuc/actions/workflows/check.yaml) [![codecov](https://codecov.io/gh/pik-piam/GDPuc/branch/main/graph/badge.svg?token=3GHXFQXARX)](https://app.codecov.io/gh/pik-piam/GDPuc) ![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg) -[![R-CMD-check](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml) GDPuc (a.k.a. the GDP unit-converter) provides a simple function to @@ -71,6 +70,18 @@ GDP units. All common GDP units are supported, i.e.: Here “YYYY” is a placeholder for a year, e.g. “2010” or “2015”, and “LCU” stands for Local Currency Unit. +For a quick conversion of a single value use `convertSingle`. + +``` r +convertSingle( + x = 100, + iso3c = "FRA", + year = 2000, + unit_in = "current LCU", + unit_out = "constant 2017 Int$PPP" +) +``` + ## Example ``` r @@ -104,6 +115,25 @@ convertGDP( #> 3 USA 2012 126. #> 4 USA 2013 127. #> 5 USA 2014 128. + +convertSingle( + x = 100, + iso3c = "USA", + year = 2010, + unit_in = "current LCU", + unit_out = "constant 2017 Int$PPP" +) +#> [1] 112.0447 + +# When converting between constant currencies, the year of the GDP value is not important, +# and can be left out. +convertSingle( + x = 100, + iso3c = "USA", + unit_in = "constant 2005 LCU", + unit_out = "constant 2017 Int$PPP" +) +#> [1] 123.1357 ``` ## Further Options