diff --git a/.buildlibrary b/.buildlibrary index b634c00..4743d23 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '198360' +ValidationKey: '218218' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 3acf3de..36069ef 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: 'piamPlotComparison: Create comparison plots for your model results' -version: 0.0.10 -date-released: '2024-04-23' +version: 0.0.11 +date-released: '2024-04-25' abstract: A frameworks to create comparison plots for your model results. authors: - family-names: Benke diff --git a/DESCRIPTION b/DESCRIPTION index 2bd5fab..e5374fd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: piamPlotComparison Title: Create comparison plots for your model results -Version: 0.0.10 -Date: 2024-04-23 +Version: 0.0.11 +Date: 2024-04-25 Authors@R: c( person("Falk", "Benke", , "benke@pik-potsdam.de", role = c("aut", "cre")), person("Christof", "Schoetz", role = "aut") diff --git a/R/compareScenarios.R b/R/compareScenarios.R index f4ac755..e8e8da7 100644 --- a/R/compareScenarios.R +++ b/R/compareScenarios.R @@ -39,11 +39,6 @@ #' scenario. The paths must be provided in the same order as \code{mifScen}. #' If provided, some information gathered from these files is #' shown at the beginning of the output document.} -#' \item{\code{cfgDefault}}{ -#' \code{character(1) or NULL}. -#' Path to default.cfg, which creates a \code{cfg} object with default -#' values. If provided, some information gathered from this file is -#' shown at the beginning of the output document.} #' \item{\code{docTitle}}{ #' \code{character(n) or NULL}. #' Title of the document. Defaults to 'Compare Scenarios'} @@ -108,7 +103,6 @@ #' mifScen = c(ScenarioName1 = "path/to/scen1.mif", ScenarioName2 = "path/to/scen2.mif"), #' mifHist = "path/to/historical.mif", #' cfgScen = c("path/to/scen1/config.RData", "path/to/scen2/config.RData"), -#' cfgDefault = "path/to/default.cfg", #' outputDir = "path/to/output", #' outputFormat = "Rmd", #' outputFile = format(Sys.time(), "compScen_%Y%m%d-%H%M%S"), @@ -144,9 +138,6 @@ compareScenarios <- function( if (!is.null(yamlParams[["cfgScen"]])) { yamlParams$cfgScen <- normalizePath(yamlParams$cfgScen, mustWork = TRUE) } - if (!is.null(yamlParams[["cfgDefault"]])) { - yamlParams$cfgDefault <- normalizePath(yamlParams$cfgDefault, mustWork = TRUE) - } if (!is.null(yamlParams[["userSectionPath"]])) { yamlParams$userSectionPath <- normalizePath(yamlParams$userSectionPath, mustWork = TRUE) } diff --git a/README.md b/README.md index 1a0cca4..be60522 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Create comparison plots for your model results -R package **piamPlotComparison**, version **0.0.10** +R package **piamPlotComparison**, version **0.0.11** [![CRAN status](https://www.r-pkg.org/badges/version/piamPlotComparison)](https://cran.r-project.org/package=piamPlotComparison) [![R build status](https://github.com/pik-piam/piamPlotComparison/workflows/check/badge.svg)](https://github.com/pik-piam/piamPlotComparison/actions) [![codecov](https://codecov.io/gh/pik-piam/piamPlotComparison/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/piamPlotComparison) [![r-universe](https://pik-piam.r-universe.dev/badges/piamPlotComparison)](https://pik-piam.r-universe.dev/builds) @@ -46,7 +46,7 @@ In case of questions / problems please contact Falk Benke To cite package **piamPlotComparison** in publications use: -Benke F, Schoetz C (2024). _piamPlotComparison: Create comparison plots for your model results_. R package version 0.0.10, . +Benke F, Schoetz C (2024). _piamPlotComparison: Create comparison plots for your model results_. R package version 0.0.11, . A BibTeX entry for LaTeX users is @@ -55,7 +55,7 @@ A BibTeX entry for LaTeX users is title = {piamPlotComparison: Create comparison plots for your model results}, author = {Falk Benke and Christof Schoetz}, year = {2024}, - note = {R package version 0.0.10}, + note = {R package version 0.0.11}, url = {https://github.com/pik-piam/piamPlotComparison}, } ``` diff --git a/inst/compareScenarios/cs_99_further_info.Rmd b/inst/compareScenarios/cs_99_further_info.Rmd index 2d13b1c..5fd00f5 100644 --- a/inst/compareScenarios/cs_99_further_info.Rmd +++ b/inst/compareScenarios/cs_99_further_info.Rmd @@ -86,56 +86,9 @@ if (exists("cfgGms") && !is.null(cfgGms)) { cfgGmsWide %>% select(-where(~ length(unique(.)) == 1)) %>% select(scenario, everything()) - cfgGmsWideSame <- - cfgGmsWide %>% - select(where(~ length(unique(.)) == 1)) %>% - distinct() -} -``` - - -```{r results='asis'} -# Show all gms config option that is the same in all scenarios but differs from the default. -if (exists("cfgDefault") && !is.null(cfgDefault) && - exists("cfgGmsWideSame") && !is.null(cfgGmsWideSame)) { - colNames <- intersect(names(cfgGmsWideSame), names(cfgDefault$gms)) - # the types may differ between the two lists, so convert to character - isSameAsDefault <- vapply( - colNames, - function(nm) { - identical( - as.character(cfgDefault$gms[[nm]]), - as.character(unname(cfgGmsWideSame[[nm]]))) - }, - logical(1) - ) - cfgGmsWideSameDiffDefault <- - bind_rows( - lapply(cfgGmsWideSame[colNames[!isSameAsDefault]], as.character), - lapply(cfgDefault$gms[colNames[!isSameAsDefault]], as.character)) - - cat("## GAMS Config Non-Default\n\n") - - cat("Following GAMS settings are the same in all scenarios but different from the default settings.\n\n") - - bind_cols( - Source = c("Scenarios", "Default"), - cfgGmsWideSameDiffDefault - ) %>% - showInTables() - - cat( - "Following GAMS settings are the same in all scenarios and not present in the default file:\n\n") - - bind_cols( - Source = "Scenarios", - cfgGmsWideSame[setdiff(names(cfgGmsWideSame), names(cfgDefault$gms))] - ) %>% - showInTables() } ``` - ```{r results='asis'} # Show all gms config options that differ between scenarios. if (exists("cfgGmsWideDiff") && !is.null(cfgGmsWideDiff)) { diff --git a/inst/compareScenarios/cs_main.Rmd b/inst/compareScenarios/cs_main.Rmd index 9aa6a62..306adef 100644 --- a/inst/compareScenarios/cs_main.Rmd +++ b/inst/compareScenarios/cs_main.Rmd @@ -22,7 +22,6 @@ params: mifScen: "" mifScenNames: null cfgScen: null - cfgDefault: null mifHist: "" yearsScen: !r c(seq(2005, 2060, 5), seq(2070, 2100, 10)) yearsHist: !r c(seq(1960, 2024, 1), seq(2025, 2100, 5)) @@ -119,11 +118,7 @@ if (!is.null(params$cfgScen)) { filter(name != "gms") rm(cfgs) } -if (!is.null(params$cfgDefault)) { - env <- new.env() - source(params$cfgDefault, local = env, echo = FALSE) # nolint - cfgDefault <- env$cfg -} + ``` diff --git a/man/compareScenarios.Rd b/man/compareScenarios.Rd index 8b9b792..eedd7b0 100644 --- a/man/compareScenarios.Rd +++ b/man/compareScenarios.Rd @@ -68,11 +68,6 @@ choose Rmd as output format and obtain a copy of the *.Rmd-files. scenario. The paths must be provided in the same order as \code{mifScen}. If provided, some information gathered from these files is shown at the beginning of the output document.} - \item{\code{cfgDefault}}{ - \code{character(1) or NULL}. - Path to default.cfg, which creates a \code{cfg} object with default - values. If provided, some information gathered from this file is - shown at the beginning of the output document.} \item{\code{docTitle}}{ \code{character(n) or NULL}. Title of the document. Defaults to 'Compare Scenarios'} @@ -138,7 +133,6 @@ compareScenarios( mifScen = c(ScenarioName1 = "path/to/scen1.mif", ScenarioName2 = "path/to/scen2.mif"), mifHist = "path/to/historical.mif", cfgScen = c("path/to/scen1/config.RData", "path/to/scen2/config.RData"), - cfgDefault = "path/to/default.cfg", outputDir = "path/to/output", outputFormat = "Rmd", outputFile = format(Sys.time(), "compScen_\%Y\%m\%d-\%H\%M\%S"),