-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from robinhasse/compareScenarios
Compare scenarios
- Loading branch information
Showing
21 changed files
with
250 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,7 @@ | |
^codecov\.yml$ | ||
^\.github$ | ||
^.*CITATION.cff$ | ||
^.*_Rmd/?.*$ | ||
^.*\.pdf$ | ||
^.lintr$ | ||
^tests/.lintr$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
ValidationKey: '218185' | ||
ValidationKey: '397020' | ||
AutocreateReadme: yes | ||
AcceptedWarnings: | ||
- 'Warning: package ''.*'' was built under R version' | ||
- 'Warning: namespace ''.*'' is not available and has been replaced' | ||
AcceptedNotes: ~ | ||
AcceptedNotes: Namespaces in Imports field not imported from\:\n *.mip. .piamPlotComparison. | ||
allowLinterWarnings: no | ||
enforceVersionUpdate: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
.Rhistory | ||
.RData | ||
.Ruserdata | ||
*_Rmd/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Type: Package | ||
Package: reportbrick | ||
Title: Reporting package for BRICK | ||
Version: 0.1.1 | ||
Date: 2024-04-22 | ||
Version: 0.2.0 | ||
Date: 2024-05-08 | ||
Authors@R: | ||
person("Robin", "Hasse", , "[email protected]", | ||
role = c("aut", "cre"), | ||
|
@@ -15,6 +15,8 @@ Imports: | |
gamstransfer (>= 3.0.1), | ||
madrat, | ||
magclass, | ||
mip (>= 0.148.15), | ||
piamPlotComparison, | ||
yaml | ||
Suggests: | ||
covr, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#' Read brickSets mapping | ||
#' | ||
#' @param tmpl character, BRICK reporting template | ||
#' @returns named list with definition of common set elements | ||
#' | ||
#' @importFrom madrat toolGetMapping | ||
#' @importFrom yaml read_yaml | ||
|
||
readBrickSets <- function(tmpl) { | ||
# use default file as basis | ||
file <- "brickSets.yaml" | ||
brickSets <- .readMapping(file) | ||
|
||
# replace default sets with custom sets where defined | ||
if (!is.null(tmpl)) { | ||
if (file.exists(tmpl)) { | ||
file <- tmpl | ||
customBrickSets <- read_yaml(file) | ||
} else { | ||
file <- paste0("brickSets_", tmpl, ".yaml") | ||
customBrickSets <- .readMapping(file) | ||
} | ||
brickSets[names(customBrickSets)] <- customBrickSets | ||
} | ||
|
||
# duplicate aliases | ||
brickSetsExplicit <- list() | ||
for (dimName in names(brickSets)) { | ||
dim <- brickSets[dimName] | ||
aliases <- dim[[1]][["alias"]] | ||
dim[[1]][["alias"]] <- NULL | ||
aliasDims <- rep(dim, length(aliases)) | ||
names(aliasDims) <- aliases | ||
brickSetsExplicit <- c(brickSetsExplicit, c(as.list(dim), aliasDims)) | ||
} | ||
|
||
attr(brickSetsExplicit, "file") <- file | ||
return(brickSetsExplicit) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
.readMapping <- function(file) { | ||
toolGetMapping(name = file, | ||
type = "sectoral", | ||
where = "reportbrick", | ||
returnPathOnly = TRUE) %>% | ||
read_yaml() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.