Skip to content

Commit

Permalink
Dont use non standard evaluation
Browse files Browse the repository at this point in the history
build
  • Loading branch information
dklein-pik committed Feb 1, 2024
1 parent c27bddd commit 7cd71d3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '3179428'
ValidationKey: '3200148'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2.9027
rev: v0.3.2.9025
hooks:
- id: parsable-R
- id: deps-in-desc
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'modelstats: Run Analysis Tools'
version: 0.16.1
date-released: '2024-01-26'
version: 0.16.2
date-released: '2024-02-01'
abstract: A collection of tools to analyze model runs.
authors:
- family-names: Giannousakis
Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: modelstats
Type: Package
Title: Run Analysis Tools
Version: 0.16.1
Date: 2024-01-26
Version: 0.16.2
Date: 2024-02-01
Authors@R: c(
person("Anastasis", "Giannousakis", email = "[email protected]", role = c("aut","cre")),
person("Oliver", "Richters", role = "aut")
Expand All @@ -21,7 +21,8 @@ Imports:
magclass,
remind2,
gms,
withr
withr,
rlang
Suggests:
covr,
knitr,
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(modeltests)
export(printOutput)
export(promptAndRun)
import(crayon)
importFrom(dplyr,"%>%")
importFrom(dplyr,filter)
importFrom(gdx,readGDX)
importFrom(gms,loadConfig)
Expand All @@ -21,5 +22,6 @@ importFrom(magclass,write.report)
importFrom(piamModelTests,iamCheck)
importFrom(quitte,read.quitte)
importFrom(remind2,compareScenarios2)
importFrom(rlang,.data)
importFrom(utils,read.csv2)
importFrom(utils,tail)
19 changes: 10 additions & 9 deletions R/modeltests.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#' @importFrom lucode2 sendmail
#' @importFrom remind2 compareScenarios2
#' @importFrom magclass read.report write.report collapseNames
#' @importFrom rlang .data
#' @export
modeltests <- function(
mydir = ".",
Expand Down Expand Up @@ -224,8 +225,8 @@ evaluateRuns <- function(model, mydir, gitPath, compScen, email, mattermostToken
myfile, append = TRUE)
write(paste0("If you are currently viewing the email: Overview of the last test is in red, ",
"and of the current test in green"), myfile, append = TRUE)
gitInfo <- c(paste("Tested commit:", commitTested),

gitInfo <- c(paste("Tested commit:", commitTested),
paste("The test of", today, "contains these merges:"),
commitsSinceLastTest)
write(gitInfo, myfile, append = TRUE)
Expand Down Expand Up @@ -291,17 +292,17 @@ evaluateRuns <- function(model, mydir, gitPath, compScen, email, mattermostToken
setwd(i)
message("Changed to ", normalizePath("."))
cfg <- NULL
if (any(grepl(basename(getwd()), rownames(filter(gRS, Conv == "converged", Mif == "yes"))))) {
if (any(grepl(basename(getwd()), rownames(filter(gRS, .data$Conv == "converged", .data$Mif == "yes"))))) {
load("config.Rdata")
} else {
setwd("../")
message("Skipping ", i, " and changed back to ", normalizePath("."))
next
}
sameRuns <- gRS %>% filter(Conv %in% c("converged", "converged (had INFES)"), # runs have to be converged
Mif == "yes", # need to have mifs
grepl(cfg$title, rownames(gRS)), # must be the same scenario
! rownames(gRS) %in% basename(cfg$results_folder)) %>% # but not the current run
sameRuns <- gRS %>% filter(.data$Conv %in% c("converged", "converged (had INFES)"), # runs have to be converged
.data$Mif == "yes", # need to have mifs
grepl(cfg$title, rownames(gRS)), # must be the same scenario
! rownames(gRS) %in% basename(cfg$results_folder)) %>% # but not the current run
rownames()
if (length(sameRuns) > 0) {
lastRun <- max(sameRuns[sameRuns < basename(cfg$results_folder)])
Expand Down Expand Up @@ -363,7 +364,7 @@ evaluateRuns <- function(model, mydir, gitPath, compScen, email, mattermostToken
write(paste0("The IAMC check of these runs can be found in /p/projects/remind/modeltests/output/iamccheck-",
commitTested, ".rds", "\n"), myfile, append = TRUE)
}

summary <- ifelse(length(runsStarted) > 0, paste0(unlist(unique(errorList)), collapse = ". "), "No runs started")
summary <- paste0("Summary of ", today, ": ", ifelse(summary == "", "Tests look good", summary))
write(summary, myfile, append = TRUE)
Expand All @@ -375,7 +376,7 @@ evaluateRuns <- function(model, mydir, gitPath, compScen, email, mattermostToken
sendmail(path = gitdir, file = myfile, commitmessage = "Automated Test Results", remote = TRUE, reset = TRUE)
}

message("Composing message and sending it to mattermost channel")
message("Composing message and sending it to mattermost channel")
# for MAgPIE only if warnings/errors occur, for REMIND always display AMT status
if (!is.null(mattermostToken)) {
# compose message, each vector element will appear in a new line in the final message.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Run Analysis Tools

R package **modelstats**, version **0.16.1**
R package **modelstats**, version **0.16.2**

[![CRAN status](https://www.r-pkg.org/badges/version/modelstats)](https://cran.r-project.org/package=modelstats) [![R build status](https://github.com/pik-piam/modelstats/workflows/check/badge.svg)](https://github.com/pik-piam/modelstats/actions) [![codecov](https://codecov.io/gh/pik-piam/modelstats/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/modelstats) [![r-universe](https://pik-piam.r-universe.dev/badges/modelstats)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -47,7 +47,7 @@ In case of questions / problems please contact Anastasis Giannousakis <giannou@p

To cite package **modelstats** in publications use:

Giannousakis A, Richters O (2024). _modelstats: Run Analysis Tools_. R package version 0.16.1, <https://github.com/pik-piam/modelstats>.
Giannousakis A, Richters O (2024). _modelstats: Run Analysis Tools_. R package version 0.16.2, <https://github.com/pik-piam/modelstats>.

A BibTeX entry for LaTeX users is

Expand All @@ -56,7 +56,7 @@ A BibTeX entry for LaTeX users is
title = {modelstats: Run Analysis Tools},
author = {Anastasis Giannousakis and Oliver Richters},
year = {2024},
note = {R package version 0.16.1},
note = {R package version 0.16.2},
url = {https://github.com/pik-piam/modelstats},
}
```

0 comments on commit 7cd71d3

Please sign in to comment.