diff --git a/.buildlibrary b/.buildlibrary index a31e83d8..67c0a7b9 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '221875483' +ValidationKey: '222064080' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index e77dc411..df1b9334 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: 'remind2: The REMIND R package (2nd generation)' -version: 1.126.1 -date-released: '2023-12-12' +version: 1.127.0 +date-released: '2023-12-13' abstract: Contains the REMIND-specific routines for data and model output manipulation. authors: - family-names: Rodrigues diff --git a/DESCRIPTION b/DESCRIPTION index 2607490d..66daa0bc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: remind2 Title: The REMIND R package (2nd generation) -Version: 1.126.1 -Date: 2023-12-12 +Version: 1.127.0 +Date: 2023-12-13 Authors@R: c( person("Renato", "Rodrigues", , "renato.rodrigues@pik-potsdam.de", role = c("aut", "cre")), person("Lavinia", "Baumstark", role = "aut"), diff --git a/README.md b/README.md index 816cd2bc..ca6c86cc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # The REMIND R package (2nd generation) -R package **remind2**, version **1.126.1** +R package **remind2**, version **1.127.0** [![CRAN status](https://www.r-pkg.org/badges/version/remind2)](https://cran.r-project.org/package=remind2) [![R build status](https://github.com/pik-piam/remind2/workflows/check/badge.svg)](https://github.com/pik-piam/remind2/actions) [![codecov](https://codecov.io/gh/pik-piam/remind2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/remind2) [![r-universe](https://pik-piam.r-universe.dev/badges/remind2)](https://pik-piam.r-universe.dev/builds) @@ -49,7 +49,7 @@ In case of questions / problems please contact Renato Rodrigues . +Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P, Weigmann P (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.127.0, . A BibTeX entry for LaTeX users is @@ -58,7 +58,7 @@ A BibTeX entry for LaTeX users is title = {remind2: The REMIND R package (2nd generation)}, author = {Renato Rodrigues and Lavinia Baumstark and Falk Benke and Jan Philipp Dietrich and Alois Dirnaichner and Pascal Führlich and Anastasis Giannousakis and Robin Hasse and Jérome Hilaire and David Klein and Johannes Koch and Katarzyna Kowalczyk and Antoine Levesque and Aman Malik and Anne Merfort and Leon Merfort and Simón Morena-Leiva and Michaja Pehl and Robert Pietzcker and Sebastian Rauner and Oliver Richters and Marianna Rottoli and Christof Schötz and Felix Schreyer and Kais Siala and Björn Sörgel and Mike Spahr and Jessica Strefler and Philipp Verpoort and Pascal Weigmann}, year = {2023}, - note = {R package version 1.126.1}, + note = {R package version 1.127.0}, url = {https://github.com/pik-piam/remind2}, } ``` diff --git a/inst/markdown/compareScenarios2/cs2_02_macro.Rmd b/inst/markdown/compareScenarios2/cs2_02_macro.Rmd index 1813c9e0..edcf4c99 100644 --- a/inst/markdown/compareScenarios2/cs2_02_macro.Rmd +++ b/inst/markdown/compareScenarios2/cs2_02_macro.Rmd @@ -206,25 +206,25 @@ walk(vars, showLinePlots, data = data) ## FE intensity of GDP -```{r FE intensity of GDP} +```{r FE intensity of GDP_PPP} items <- c( - "FE|Transport pGDP", - "FE|Buildings pGDP", - "FE|Industry pGDP") + "FE|Transport pGDP_PPP", + "FE|Buildings pGDP_PPP", + "FE|Industry pGDP_PPP") showAreaAndBarPlots(data, items, scales = "fixed") ``` -## FE intensity of GDP, linegraph (by GDP) +## FE intensity of GDP_PPP, linegraph (by pGDP_PPP) -```{r FE intensity of GDP, linegraph} +```{r FE intensity of GDP_PPP, linegraph} dIea <- data %>% # To make the plots less crowded, show only IEA historical data. filter(scenario != "historical" | model == "IEA") items <- c( - "FE|Transport pGDP", - "FE|Buildings pGDP", - "FE|Industry pGDP") + "FE|Transport pGDP_PPP", + "FE|Buildings pGDP_PPP", + "FE|Industry pGDP_PPP") showMultiLinePlots(dIea, items, scales = "fixed") showMultiLinePlotsByVariable(dIea, items, "GDP|PPP pCap", scales = "fixed") ``` @@ -248,16 +248,18 @@ kaya <- emiCO2_by_FE = `Emi|CO2|Energy` / FE, FE_by_GDP_MER = FE / `GDP|MER`, FE_by_GDP_PPP = FE / `GDP|PPP`, - GDP_by_Pop = `GDP|MER` / Population, - `Emi|CO2|Energy` = NULL, FE = NULL, `GDP|MER` = NULL) %>% + GDP_MER_by_Pop = `GDP|MER` / Population, + GDP_PPP_by_Pop = `GDP|PPP` / Population, + `Emi|CO2|Energy` = NULL, FE = NULL, `GDP|MER` = NULL, `GDP|PPP` = NULL) %>% pivot_longer( - c(emiCO2_by_FE, FE_by_GDP_MER, FE_by_GDP_PPP, GDP_by_Pop, Population), + c(emiCO2_by_FE, FE_by_GDP_MER, FE_by_GDP_PPP, GDP_MER_by_Pop, GDP_PPP_by_Pop, Population), names_to = "variable", values_to = "value") kayaUnits <- tribble( ~variable, ~unit, "Population", "million", - "GDP_by_Pop", "billion US$2005/yr/million", + "GDP_MER_by_Pop", "billion US$2005/yr/million", + "GDP_PPP_by_Pop", "billion US$2005/yr/million", "FE_by_GDP_MER", "EJ/billion US$2005", "FE_by_GDP_PPP", "EJ/billion US$2005", "emiCO2_by_FE", "EJ/Mt CO2") diff --git a/inst/markdown/compareScenarios2/cs2_main.Rmd b/inst/markdown/compareScenarios2/cs2_main.Rmd index df386f14..9f044d7e 100644 --- a/inst/markdown/compareScenarios2/cs2_main.Rmd +++ b/inst/markdown/compareScenarios2/cs2_main.Rmd @@ -334,7 +334,7 @@ data <- ``` -```{r calculate pGDP variables} +```{r calculate pGDP_PPP variables} dataGDP <- data %>% filter(variable == "GDP|PPP pCap") %>% @@ -345,10 +345,10 @@ dataGDP <- rename(gdp = value) # For all variables in following table, add a new variable to data with the name -# "OldName pGDP". Calculate its value by +# "OldName pGDP_PPP". Calculate its value by # OldValue / (GDP|PPP pCap) * conversionFactor # and set its unit to newUnit. -# The new variable "OldName pGDP" will be available in the plot sections. +# The new variable "OldName pGDP_PPP" will be available in the plot sections. pGdpVariables <- tribble( ~variable, ~newUnit, ~conversionFactor, "FE", "MJ/US$2005", 1e3, @@ -363,8 +363,8 @@ dataPGdp <- left_join(dataGDP, c("scenario", "region", "period")) %>% mutate( value = value / gdp * conversionFactor, - variable = paste0(variable, " pGDP"), - varplus = paste0(varplus, " pGDP"), + variable = paste0(variable, " pGDP_PPP"), + varplus = paste0(varplus, " pGDP_PPP"), unit = newUnit, newUnit = NULL, conversionFactor = NULL, gdp = NULL) diff --git a/inst/markdown/nashAnalysis.Rmd b/inst/markdown/nashAnalysis.Rmd index e50cadb1..7f98e15f 100644 --- a/inst/markdown/nashAnalysis.Rmd +++ b/inst/markdown/nashAnalysis.Rmd @@ -65,7 +65,7 @@ htmltools::tagList(p) ### x: iter, slider: time, facet: enty ```{r results = "asis"} p <- mip::mipIterations( - plotData = filter(p80_surplus, tall > 2005), # for this to work, we starting year must be available for all facets + plotData = filter(p80_surplus, tall >= 2025), # for this to work, we starting year must be available for all facets xAxis = "iteration", slider = "tall", color = NULL, facets = "all_enty", facetScales = "free_y" ) %>% adjustSliderAnimation() @@ -119,7 +119,7 @@ htmltools::tagList(p) ### x: iter, slider: time, facet: enty ```{r results = "asis"} p <- mip::mipIterations( - filter(p80_pvp_itr, ttot > 2005), # for this to work, we starting year must be available for all facets + filter(p80_pvp_itr, ttot >= 2025), # for this to work, we starting year must be available for all facets xAxis = "iteration", slider = "ttot", color = NULL, facets = "all_enty", facetScales = "free_y" ) %>% adjustSliderAnimation() @@ -177,7 +177,7 @@ htmltools::tagList(p) ### x: iter, slider: time, facet: enty ```{r results = "asis"} p <- mip::mipIterations( - filter(price_not_discounted_itr, ttot > 2005), # for this to work, we starting year must be available for all facets + filter(price_not_discounted_itr, ttot >= 2025), # for this to work, we starting year must be available for all facets xAxis = "iteration", slider = "ttot", color = NULL, facets = "all_enty", facetScales = "free_y" ) %>% adjustSliderAnimation() @@ -231,7 +231,8 @@ prices_and_surplus <- left_join(p80_surplus, price_not_discounted_itr, prices_and_surplus_steps <- rbind( prices_and_surplus, .step(prices_and_surplus, 1), - .step(prices_and_surplus, 2) + .step(prices_and_surplus, 2), + .step(prices_and_surplus, 3) ) %>% mutate( "group" = ifelse(grepl("^p80_surplus", .data$variable), "p80_surplus", "p80_pvp_itr_no_discount"), @@ -244,13 +245,22 @@ prices_and_surplus_steps <- rbind( ### x: time, slider: iter, facet: var ```{r results = "asis"} + for (v in unique(prices_and_surplus_steps$all_enty)) { p <- mip::mipIterations( - plotData = filter(prices_and_surplus_steps, all_enty == v, tall >= 2005), + plotData = filter(prices_and_surplus_steps, all_enty == v, tall >= 2005), returnGgplots = TRUE, xAxis = "tall", facets = "group", color = "step", slider = "iteration", facetScales = "free_y" - ) %>% adjustSliderAnimation() + ) + + # manually override colors + plots <- p[[1]] + + ggplot2::scale_colour_manual(values = c("iter" = "#08519c", "iter+1" = "#3182bd", + "iter+2" = "#6baed6", "iter+3" = "#bdd7e7")) + plots <- list(plots) + plots <- lapply(plots, plotly::ggplotly) %>% adjustSliderAnimation() + + print(htmltools::tagList(plots)) - print(htmltools::tagList(p)) } ```