aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-12-10 11:24:16 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2015-12-10 11:30:44 +0100
commitc9667fbfd5a8c9601ac0c977776b12fe7d9b19dd (patch)
treee05516155e6a65b7bdcaf6421092534eed79eaee
parent652f58915d56aa225fc01bff007f19f3277eed9f (diff)
Improve print method for mkinmod
-rw-r--r--NEWS.md2
-rw-r--r--R/mkinmod.R5
2 files changed, 5 insertions, 2 deletions
diff --git a/NEWS.md b/NEWS.md
index 8e6ed11f..aa6207c3 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -8,6 +8,8 @@
- Give an explanatory error message when mkinmod fails due to a missing definition of a target variable
+- `print.mkinmod()`: Improve formatting when printing mkinmod model definitions
+
## mkin 0.9-41 (2015-11-09)
### Minor changes
diff --git a/R/mkinmod.R b/R/mkinmod.R
index c70f1260..5ec62bbe 100644
--- a/R/mkinmod.R
+++ b/R/mkinmod.R
@@ -363,8 +363,9 @@ print.mkinmod <- function(x, ...) {
cat("$", obs, "\n", sep = "")
spl <- x$spec[[obs]]
cat("$type:", spl$type)
- if (!is.null(spl$to)) cat(", $to: ", paste(spl$to, collapse = ", "), ", $sink: ", spl$sink, sep = "")
- if (!is.null(spl$full_name)) if (!is.na(spl$full_name)) cat(", $full_name:", spl$full_name)
+ if (!is.null(spl$to) && length(spl$to)) cat("; $to: ", paste(spl$to, collapse = ", "), sep = "")
+ cat("; $sink: ", spl$sink, sep = "")
+ if (!is.null(spl$full_name)) if (!is.na(spl$full_name)) cat("; $full_name:", spl$full_name)
cat("\n")
}
if (is.matrix(x$coefmat)) cat("Coefficient matrix $coefmat available\n")

Contact - Imprint