Skip to content

Commit

Permalink
convert preprocessing to R script
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Jul 29, 2024
1 parent 08bba20 commit 06ca9c5
Showing 1 changed file with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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",
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -172,6 +161,3 @@ dataPCap
data %>%
bind_rows(dataPCap) ->
data
```


0 comments on commit 06ca9c5

Please sign in to comment.