Skip to content

Commit

Permalink
toolWriteMadratLog
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-sauer committed May 27, 2024
1 parent d26be93 commit aa60484
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '1191000'
ValidationKey: '1390900'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ type: software
title: |-
mstools: Tool functions that can be used by several madrat-dependent or
magpie4 output functions
version: 0.6.0
date-released: '2024-05-07'
version: 0.7.0
date-released: '2024-05-27'
abstract: Tool functions that can be used by several madrat-dependent or magpie4 output
functions.
authors:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Type: Package
Package: mstools
Title: Tool functions that can be used by several madrat-dependent or
magpie4 output functions
Version: 0.6.0
Date: 2024-05-07
Version: 0.7.0
Date: 2024-05-27
Authors@R: c(
person("Benjamin Leon", "Bodirsky", , "[email protected]", role = c("aut", "cre")),
person("Kristine", "Karstens", role = "aut"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export(toolIsocode2Country)
export(toolSmooth)
export(toolStatusMessage)
export(toolSum2Country)
export(toolWriteMadratLog)
import(madrat)
import(magclass)
importFrom(madrat,toolAggregate)
Expand Down
3 changes: 2 additions & 1 deletion R/toolExpectTrue.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#' up by one in the call stack, \code{level = -1} will use \code{toolExpectTrue} itself as
#' function call.
#' @author Jan Philipp Dietrich
#' @seealso \code{\link{getMadratMessage}}, \code{\link{toolExpectLessDiff}}, \code{\link{toolStatusMessage}}
#' @seealso \code{\link{getMadratMessage}}, \code{\link{toolExpectLessDiff}},
#' \code{\link{toolStatusMessage}}, \code{\link{toolWriteMadratLog}}
#' @examples
#' toolExpectTrue(is.numeric(1), "data is numeric", level = -1)
#' getMadratMessage("status")
Expand Down
20 changes: 20 additions & 0 deletions R/toolWriteMadratLog.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#' toolWriteMadratLog
#'
#' Tool function for writing madrat messages to a log file. Useful
#' after running madrat calculations which are performing checks via
#' \code{\link{toolExpectTrue}} or other toolExpect functions.
#' @param checkResults list of check results as returned by \code{\link{getMadratMessage}}
#' @param logPath path to the log file to be written
#' @author Pascal Sauer
#' @export
toolWriteMadratLog <- function(checkResults = getMadratMessage("status"), logPath = "status.log") {
consistencyCheckLog <- NULL
for (i in seq_along(checkResults)) {
consistencyCheckLog <- paste(c(consistencyCheckLog,
names(checkResults)[[i]],
checkResults[[i]],
""),
collapse = "\n")
}
writeLines(consistencyCheckLog, logPath)
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tool functions that can be used by several madrat-dependent or
magpie4 output functions

R package **mstools**, version **0.6.0**
R package **mstools**, version **0.7.0**

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

Expand Down Expand Up @@ -40,7 +40,7 @@ In case of questions / problems please contact Benjamin Leon Bodirsky <bodirsky@

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

Bodirsky B, Karstens K, Beier F, Dietrich J (2024). _mstools: Tool functions that can be used by several madrat-dependent or magpie4 output functions_. doi:10.5281/zenodo.1158582 <https://doi.org/10.5281/zenodo.1158582>, R package version 0.6.0, <https://github.com/pik-piam/magpie4>.
Bodirsky B, Karstens K, Beier F, Dietrich J (2024). _mstools: Tool functions that can be used by several madrat-dependent or magpie4 output functions_. doi:10.5281/zenodo.1158582 <https://doi.org/10.5281/zenodo.1158582>, R package version 0.7.0, <https://github.com/pik-piam/magpie4>.

A BibTeX entry for LaTeX users is

Expand All @@ -50,7 +50,7 @@ A BibTeX entry for LaTeX users is
magpie4 output functions},
author = {Benjamin Leon Bodirsky and Kristine Karstens and Felicitas Beier and Jan Philipp Dietrich},
year = {2024},
note = {R package version 0.6.0},
note = {R package version 0.7.0},
url = {https://github.com/pik-piam/magpie4},
doi = {10.5281/zenodo.1158582},
}
Expand Down
3 changes: 2 additions & 1 deletion man/toolExpectTrue.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions man/toolWriteMadratLog.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aa60484

Please sign in to comment.