From 06ca9c525a6263c52bdc033e96adf686ba5d7b99 Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Mon, 29 Jul 2024 16:27:16 +0200 Subject: [PATCH] convert preprocessing to R script --- .../{preprocessing.Rmd => preprocessing.R} | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) rename inst/compareScenarios/{preprocessing.Rmd => preprocessing.R} (95%) diff --git a/inst/compareScenarios/preprocessing.Rmd b/inst/compareScenarios/preprocessing.R similarity index 95% rename from inst/compareScenarios/preprocessing.Rmd rename to inst/compareScenarios/preprocessing.R index 58dc4f8..4b1730c 100644 --- a/inst/compareScenarios/preprocessing.Rmd +++ b/inst/compareScenarios/preprocessing.R @@ -1,11 +1,4 @@ -```{r load additional libraries} - -library(ggplot2) -library(dplyr) - -``` - -```{r reference models for historical} +# reference models for historical ---- # Sometimes it is necessary to choose a single model for the historical data, # e.g., calculating per capita variables. These reference models are defined here. @@ -15,12 +8,9 @@ histRefModel <- c( "GDP|PPP pCap" = "James_IMF" ) -options(mip.histRefModel = histRefModel) # nolint - -``` +options(mip.histRefModel = histRefModel) - -```{r load custom plotting function} +# load custom plotting function ---- showLinePlotsByVariable <- function( data, vars, xVar, scales = "free_y", @@ -109,9 +99,8 @@ showLinePlotsByVariable <- function( return(invisible(NULL)) } -``` +# calculate pCap variables ---- -```{r calcuate pCap variables} # For all variables in following table, add a new variable to data with the name # "OldName pCap". Calculate its value by OldValue * conversionFactor and set its unit to newUnit. # The new variable "OldName pCap" will be available in the plot sections. @@ -172,6 +161,3 @@ dataPCap data %>% bind_rows(dataPCap) -> data -``` - -