From 69ea26c45d662477dacbcd3abab678d4a4fb46b2 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.priv>
Date: Fri, 7 Jun 2019 11:12:57 +0200
Subject: [PATCH] v1.2.16.28 CLEAN: warning msg management improved in
 plot.OutputsModel fun

---
 DESCRIPTION           | 2 +-
 NEWS.rmd              | 2 +-
 R/plot.OutputsModel.R | 7 ++++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 0107f6b1..7bfe3927 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.2.16.27
+Version: 1.2.16.28
 Date: 2019-06-07
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
diff --git a/NEWS.rmd b/NEWS.rmd
index fe1b98c7..68cbb735 100644
--- a/NEWS.rmd
+++ b/NEWS.rmd
@@ -14,7 +14,7 @@ output:
 
 
 
-### 1.2.16.27 Release Notes (2019-06-07)
+### 1.2.16.28 Release Notes (2019-06-07)
 
 
 #### New features
diff --git a/R/plot.OutputsModel.R b/R/plot.OutputsModel.R
index 04dad71e..f5b06900 100644
--- a/R/plot.OutputsModel.R
+++ b/R/plot.OutputsModel.R
@@ -70,6 +70,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
   
   
   ## check 'which'
+  whichNeedQobs  <- c("Error", "CorQQ")
   whichDashboard <- c("all", "synth", "ts", "perf")
   whichAll   <- c("Precip", "PotEvap", "Temp", "SnowPack", "Flows", "Error", "Regime", "CumFreq", "CorQQ")
   whichSynth <- c("Precip"           , "Temp", "SnowPack", "Flows"         , "Regime", "CumFreq", "CorQQ")
@@ -116,14 +117,14 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
     which <- c(which, whichAll)
   }
   if (is.null(Qobs)) {
-    if (length(which) == 1 & any(which %in% c("CorQQ", "Error"))) {
+    if (length(which) == 1 & any(which %in% whichNeedQobs)) {
       stop(sprintf("the %s plot(s) cannot be drawn if there is no 'Qobs'", shQuote(which)))
     }
-    if (length(which) != 1 & any(which %in% c("CorQQ", "Error"))) {
+    if (length(which) != 1 & any(which %in% whichNeedQobs)) {
       BOOL_CorQQ <- FALSE
       BOOL_Error <- FALSE
       warning(sprintf("the %s plot(s) cannot be drawn if there is no 'Qobs'",
-                      paste0(shQuote(c("CorQQ", "Error")), collapse = " and ")))
+                      paste0(shQuote(whichNeedQobs), collapse = " and ")))
     }
   }
   
-- 
GitLab