From baa633a54a9bc4840b8a766710558de5f44b9e49 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Fri, 28 Feb 2025 19:06:21 +0100
Subject: [PATCH 01/13] typo

---
 gitlab-ci/unittests.gitlab-ci.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gitlab-ci/unittests.gitlab-ci.yml b/gitlab-ci/unittests.gitlab-ci.yml
index d7cf5f9..049611f 100644
--- a/gitlab-ci/unittests.gitlab-ci.yml
+++ b/gitlab-ci/unittests.gitlab-ci.yml
@@ -4,14 +4,14 @@
   script:
     - Rscript -e 'pak::pkg_install(pkg = c("XML"), upgrade = FALSE)'
     - |
-      r -e "devtools::load_all();
+      Rscript -e 'devtools::load_all();
       options(stacomiR.dbname = "'$PG_DB'",
       stacomiR.host = "'$PG_HOST'",
       stacomiR.port = "'$PG_PORT'",
       stacomiR.user = "'$PG_USER'",
-      stacomiR.password ="'PG_USER_PASSWORD'");
-      test <- capture.output(devtools::test(reporter='junit')) ; 
-      XML::saveXML(XML::xmlParse(test[grep('?xml version', test):length(test)]), file = 'public/test.xml')"
+      stacomiR.password ="'$PG_USER_PASSWORD'");
+      test <- capture.output(devtools::test(reporter="junit")) ; 
+      XML::saveXML(XML::xmlParse(test[grep("?xml version", test):length(test)]), file = "public/test.xml")''
   artifacts:
     when: always
     # You should set the job that uploads the screenshot to
-- 
GitLab


From 30c66722194152c7d5294f50f8267dacfebfca1b Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Fri, 28 Feb 2025 20:12:47 +0100
Subject: [PATCH 02/13] test

---
 gitlab-ci/unittests.gitlab-ci.yml | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/gitlab-ci/unittests.gitlab-ci.yml b/gitlab-ci/unittests.gitlab-ci.yml
index 049611f..17d6e1a 100644
--- a/gitlab-ci/unittests.gitlab-ci.yml
+++ b/gitlab-ci/unittests.gitlab-ci.yml
@@ -5,22 +5,21 @@
     - Rscript -e 'pak::pkg_install(pkg = c("XML"), upgrade = FALSE)'
     - |
       Rscript -e 'devtools::load_all();
-      options(stacomiR.dbname = "'$PG_DB'",
-      stacomiR.host = "'$PG_HOST'",
-      stacomiR.port = "'$PG_PORT'",
-      stacomiR.user = "'$PG_USER'",
-      stacomiR.password ="'$PG_USER_PASSWORD'");
-      test <- capture.output(devtools::test(reporter="junit")) ; 
-      XML::saveXML(XML::xmlParse(test[grep("?xml version", test):length(test)]), file = "public/test.xml")''
+      options(stacomiR.dbname = "'${PG_DB}'",
+      stacomiR.host = "'${PG_HOST}'",
+      stacomiR.port = "'${PG_PORT}'",
+      stacomiR.user = "'${PG_USER}'",
+      stacomiR.password ="'${PG_USER_PASSWORD}'");
+      devtools::test(reporter=JunitReporter$new(file = "junit_result.xml"));'
   artifacts:
     when: always
     # You should set the job that uploads the screenshot to
     #artifacts:when: always so that it still uploads a screenshot
     #when a test fails.
     paths:
-      - public/test.xml
+      - check
     reports:
-      junit: public/test.xml
+      junit: check/stacomir.Rcheck/tests/testthat/junit_result.xml
     expire_in: 30 days
 
 # en dev
-- 
GitLab


From fa4b564978bd3f9962ee3cd73abf39f2b3eb1941 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Fri, 28 Feb 2025 20:20:31 +0100
Subject: [PATCH 03/13] up

---
 .gitignore                        | 1 +
 gitlab-ci/unittests.gitlab-ci.yml | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 479a553..66f9146 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ stacomir.Rproj
 /~import_coe20092015.csv
 .dbeaver/project-settings.json
 docs
+tests/testthat/junit_result.xml
diff --git a/gitlab-ci/unittests.gitlab-ci.yml b/gitlab-ci/unittests.gitlab-ci.yml
index 17d6e1a..a5dfd47 100644
--- a/gitlab-ci/unittests.gitlab-ci.yml
+++ b/gitlab-ci/unittests.gitlab-ci.yml
@@ -3,6 +3,7 @@
   stage: test
   script:
     - Rscript -e 'pak::pkg_install(pkg = c("XML"), upgrade = FALSE)'
+    - Rscript -e 'cat("PG_HOST = "'${PG_HOST}'"\n")'
     - |
       Rscript -e 'devtools::load_all();
       options(stacomiR.dbname = "'${PG_DB}'",
@@ -19,7 +20,7 @@
     paths:
       - check
     reports:
-      junit: check/stacomir.Rcheck/tests/testthat/junit_result.xml
+      junit: tests/testthat/junit_result.xml
     expire_in: 30 days
 
 # en dev
-- 
GitLab


From 2e50e05be731503764d57a56de44620e153a75b3 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Fri, 28 Feb 2025 20:27:28 +0100
Subject: [PATCH 04/13] test

---
 gitlab-ci/codecov.gitlab-ci.yml   | 10 +++++-----
 gitlab-ci/unittests.gitlab-ci.yml |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gitlab-ci/codecov.gitlab-ci.yml b/gitlab-ci/codecov.gitlab-ci.yml
index cbd6072..a4eb6cd 100644
--- a/gitlab-ci/codecov.gitlab-ci.yml
+++ b/gitlab-ci/codecov.gitlab-ci.yml
@@ -7,11 +7,11 @@
     - Rscript -e 'pak::pak(pkg = ".", upgrade = FALSE)'
     - |
       Rscript -e 'Sys.setenv("NOT_CRAN"= "true"); devtools::load_all(); 
-      options(stacomiR.dbname = "'$PG_DB'",
-      stacomiR.host = "'$PG_HOST'",
-      stacomiR.port = "'$PG_PORT'",
-      stacomiR.user = "'$PG_USER'",
-      stacomiR.password ="'PG_USER_PASSWORD'");
+      options(stacomiR.dbname = "'${PG_DB}'",
+      stacomiR.host = "'${PG_HOST}'",
+      stacomiR.port = "'${PG_PORT}'",
+      stacomiR.user = "'${PG_USER}'",
+      stacomiR.password ="'${PG_USER_PASSWORD}'");
       covr::gitlab(quiet = FALSE)'
   coverage: '/Coverage: \d+\.\d+/' 
   artifacts:
diff --git a/gitlab-ci/unittests.gitlab-ci.yml b/gitlab-ci/unittests.gitlab-ci.yml
index a5dfd47..4cf2f7f 100644
--- a/gitlab-ci/unittests.gitlab-ci.yml
+++ b/gitlab-ci/unittests.gitlab-ci.yml
@@ -3,7 +3,7 @@
   stage: test
   script:
     - Rscript -e 'pak::pkg_install(pkg = c("XML"), upgrade = FALSE)'
-    - Rscript -e 'cat("PG_HOST = "'${PG_HOST}'"\n")'
+    - Rscript -e 'cat("PG_HOST = '${PG_HOST}'\n")'
     - |
       Rscript -e 'devtools::load_all();
       options(stacomiR.dbname = "'${PG_DB}'",
-- 
GitLab


From a253f99e2fc3a95c69d53b7de0ed1f1722034338 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Fri, 28 Feb 2025 21:23:42 +0100
Subject: [PATCH 05/13] up

---
 gitlab-ci/unittests.gitlab-ci.yml |  2 --
 tests/testthat/helper.R           | 14 +++++++-------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/gitlab-ci/unittests.gitlab-ci.yml b/gitlab-ci/unittests.gitlab-ci.yml
index 4cf2f7f..b67e0b5 100644
--- a/gitlab-ci/unittests.gitlab-ci.yml
+++ b/gitlab-ci/unittests.gitlab-ci.yml
@@ -17,8 +17,6 @@
     # You should set the job that uploads the screenshot to
     #artifacts:when: always so that it still uploads a screenshot
     #when a test fails.
-    paths:
-      - check
     reports:
       junit: tests/testthat/junit_result.xml
     expire_in: 30 days
diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R
index f9ee689..7fa4135 100644
--- a/tests/testthat/helper.R
+++ b/tests/testthat/helper.R
@@ -3,13 +3,13 @@
 # this file is called before testhat so funcion will be available in all test
 # https://testthat.r-lib.org/articles/test-fixtures.html#withr-defer-
 # could have used with_envvar and local_envvar but had to set them each time
-options(
-  stacomiR.dbname = "bd_contmig_nat",
-  stacomiR.host = "localhost",
-  stacomiR.port = "5432",
-  stacomiR.user = "stacomi_test",
-  stacomiR.password = "stacomi_test"
-)
+# options(
+#   stacomiR.dbname = "bd_contmig_nat",
+#   stacomiR.host = "localhost",
+#   stacomiR.port = "5432",
+#   stacomiR.user = "stacomi_test",
+#   stacomiR.password = "stacomi_test"
+# )
 password <- getOption("stacomiR.password") # if not set will be ""
 dbname <- getOption("stacomiR.dbname") # if not set will be ""
 user <- getOption("stacomiR.user")
-- 
GitLab


From bbad86252ea72db8083aa3dfaeb4f283599f1dda Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Fri, 28 Feb 2025 23:39:35 +0100
Subject: [PATCH 06/13] up

---
 R/stacomi.R                                 | 203 ++++++++++----------
 tests/testthat/helper.R                     |   8 +-
 tests/testthat/test-03-report_df.R          | 168 ++++++++--------
 tests/testthat/test-05-report_sample_char.R |   6 +-
 4 files changed, 195 insertions(+), 190 deletions(-)

diff --git a/R/stacomi.R b/R/stacomi.R
index f4d5a55..253e23a 100644
--- a/R/stacomi.R
+++ b/R/stacomi.R
@@ -1,88 +1,93 @@
 #'
-#' 
+#'
 #' Internal function, tests the connection and if it works loads the stacomi interface
 #' @note \code{base} is copied by stacomi into envir_stacomi. Same for \code{database_expected}
-#' 
+#'
 #' @param ... Other arguments
 #' @return Nothing
 #' @author Cedric Briand \email{cedric.briand@eptb-vilaine.fr}
 #' @keywords internal
 load_stacomi <- function(...) {
-	
-	# assigned when passing through stacomi
-	database_expected <- get("database_expected", envir_stacomi)  # logical true or false
-	
-	if (database_expected) {
-		sch <- get_schema()
-		dbname  <- options("stacomiR.dbname")[[1]]
-		host <- options("stacomiR.host")[[1]]
-		port <- options("stacomiR.port")[[1]]
-		user <- options("stacomiR.user")[[1]]
-		password <- options("stacomiR.password")[[1]]
-		if (user=="") {
-			# this is the default options at start
-			# if interactive will try to set the options upon loading
-			if (interactive()){
-				user <- readline(prompt="Enter user: ")
-				options("stacomiR.user"=user)
-				password <- readline(prompt="Enter password: ")	
-				options("stacomiR.password"=password)
-			} else {
-				user <- "group_stacomi"
-				password <- "group_stacomi"
-				warning('no user set by default, reverted to user <- "postgres" and  password <- "postgres", 
+  # assigned when passing through stacomi
+  database_expected <- get("database_expected", envir_stacomi) # logical true or false
+
+  if (database_expected) {
+    sch <- get_schema()
+    dbname <- options("stacomiR.dbname")[[1]]
+    host <- options("stacomiR.host")[[1]]
+    port <- options("stacomiR.port")[[1]]
+    user <- options("stacomiR.user")[[1]]
+    password <- options("stacomiR.password")[[1]]
+    if (user == "") {
+      # this is the default options at start
+      # if interactive will try to set the options upon loading
+      if (interactive()) {
+        user <- readline(prompt = "Enter user: ")
+        options("stacomiR.user" = user)
+        password <- readline(prompt = "Enter password: ")
+        options("stacomiR.password" = password)
+      } else {
+        user <- "group_stacomi"
+        password <- "group_stacomi"
+        warning('no user set by default, reverted to user <- "postgres" and  password <- "postgres",
 								you can change it with options("stacomiR.user"=user) and options("stacomiR.password"=password)')
-			}
-		}
-		
-		
-		con = new("ConnectionDB")
-		e = expression(con <- connect(con))
-		con = tryCatch(eval(e), error = function(e) e)
-		if ("Rcpp::exception"%in%class(con)){
-			cat(con$message)
-			test <- FALSE
-		} else {
-			test <- TRUE
-			pool::poolClose(con@connection)		
-		}
-		
-		
-		
-		# second test to check that the database is working OK		
-		
-		if (test) {
-			requete = new("RequeteDB")
-			requete@sql = paste0("select count(*) from ref.tr_taxon_tax")
-			message <- NULL
-			requete <- stacomirtools::query(requete)
-			if (grepl("Error",requete@status)) stop(requete@status)			
-			if (nrow(requete@query) == 0) {
-				# the database link is not working or the 
-				# schema
-				funout(paste(gettext("Problem during the test, connection to the database is established but failed to connect to the right schema argument passed to stacomi",
-										domain = "R-stacomiR"), "\n", 
-								gettext("dbname", domain = "R-stacomiR")," :", dbname, "\n", 
-								gettext("User", domain = "R-stacomiR"),	" :", user, "\n", 
-								gettext("Port", domain = "R-stacomiR"),	" :", port, "\n", 
-								gettext("Host", domain = "R-stacomiR"),	" :", host, "\n", 								
-								gettext("Password", domain = "R-stacomiR"),	" :", password),
-						gettext("schema", domain = "R-stacomiR"), " :", sch)
-			} 
-			
-		} else {
-			# the test has failed and the user will be prompted to another
-			funout(paste(gettext("Problem when testing the DB connection", domain = "R-stacomiR"),
-							gettext("dbname", domain = "R-stacomiR")," :", dbname, "\n", 
-							gettext("User", domain = "R-stacomiR"),	" :", user, "\n", 
-							gettext("Port", domain = "R-stacomiR"),	" :", port, "\n", 
-							gettext("Host", domain = "R-stacomiR"),	" :", host, "\n", 								
-							gettext("Password", domain = "R-stacomiR"),	" :", password))
-		}  # end else test (else == the test didn't pass, we have to change the name and password
-	} else {
-		# here : database_expected=FALSE we don't want to check the connection
-		# at all...
-	}
+      }
+    }
+
+
+    con <- new("ConnectionDB")
+    e <- expression(con <- connect(con))
+    con <- tryCatch(eval(e), error = function(e) e)
+    if ("Rcpp::exception" %in% class(con)) {
+      cat(con$message)
+      test <- FALSE
+    } else {
+      test <- TRUE
+      pool::poolClose(con@connection)
+    }
+
+
+
+    # second test to check that the database is working OK
+
+    if (test) {
+      requete <- new("RequeteDB")
+      requete@sql <- paste0("select count(*) from ref.tr_taxon_tax")
+      message <- NULL
+      requete <- stacomirtools::query(requete)
+      if (grepl("Error", requete@status)) stop(requete@status)
+      if (nrow(requete@query) == 0) {
+        # the database link is not working or the
+        # schema
+        funout(
+          paste(
+            gettext("Problem during the test, connection to the database is established but failed to connect to the right schema argument passed to stacomi",
+              domain = "R-stacomiR"
+            ), "\n",
+            gettext("dbname", domain = "R-stacomiR"), " :", dbname, "\n",
+            gettext("User", domain = "R-stacomiR"), " :", user, "\n",
+            gettext("Port", domain = "R-stacomiR"), " :", port, "\n",
+            gettext("Host", domain = "R-stacomiR"), " :", host, "\n",
+            gettext("Password", domain = "R-stacomiR"), " :", password
+          ),
+          gettext("schema", domain = "R-stacomiR"), " :", sch
+        )
+      }
+    } else {
+      # the test has failed and the user will be prompted to another
+      funout(paste(
+        gettext("Problem when testing the DB connection", domain = "R-stacomiR"),
+        gettext("dbname", domain = "R-stacomiR"), " :", dbname, "\n",
+        gettext("User", domain = "R-stacomiR"), " :", user, "\n",
+        gettext("Port", domain = "R-stacomiR"), " :", port, "\n",
+        gettext("Host", domain = "R-stacomiR"), " :", host, "\n",
+        gettext("Password", domain = "R-stacomiR"), " :", password
+      ))
+    } # end else test (else == the test didn't pass, we have to change the name and password
+  } else {
+    # here : database_expected=FALSE we don't want to check the connection
+    # at all...
+  }
 }
 
 
@@ -91,7 +96,7 @@ load_stacomi <- function(...) {
 
 
 #' stacomi Main launcher for program stacomi
-#' 
+#'
 #' When \code{database_expected=FALSE} a connection to the database is not expected. Therefore test are run by calling examples object stored in Rdata.
 #' To change the language use Sys.setenv(LANG = 'fr') or Sys.setenv(LANG = 'en')
 #' @param database_expected Boolean, if \code{TRUE} pre launch tests will be run to test the connection validity
@@ -101,32 +106,34 @@ load_stacomi <- function(...) {
 #' @usage stacomi(database_expected=TRUE, datawd = "~", sch = "test")
 #' @author Cedric Briand \email{cedric.briand@eptb-vilaine.fr}
 #' @examples
-#' 
-#'  require(stacomiR)
-#' #launch stacomi 
-#'  \dontrun{ 
-#' stacomi(database_expected=TRUE, datawd='~',sch= "iav")
+#'
+#' require(stacomiR)
+#' # launch stacomi
+#' \dontrun{
+#' stacomi(database_expected = TRUE, datawd = "~", sch = "iav")
 #' }
 #' # launch stacomi without connection to the database
-#' stacomi(database_expected=FALSE)
+#' stacomi(database_expected = FALSE)
 #' # launch stacomi with options
 #' options(
-#'		stacomiR.dbname = "bd_contmig_nat",
-#'		stacomiR.host = readline(prompt = "Enter host: "),
-#'		stacomiR.port = "5432",
-#'		stacomiR.user = readline(prompt = "Enter user: "),
-#'		stacomiR.password = readline(prompt = "Enter password: ")
-#')
+#'   stacomiR.dbname = "bd_contmig_nat",
+#'   stacomiR.host = readline(prompt = "Enter host: "),
+#'   stacomiR.port = "5432",
+#'   stacomiR.user = readline(prompt = "Enter user: "),
+#'   stacomiR.password = readline(prompt = "Enter password: ")
+#' )
 #' # another usefull option to print all queries run by stacomiR to the console
-#'  options('stacomiR.printqueries'= TRUE)
+#' options("stacomiR.printqueries" = TRUE)
 #' @export
-stacomi = function(database_expected = TRUE,  datawd = "~", sch = "test") {	
-	assign("database_expected", database_expected, envir = envir_stacomi)
-	# values assigned in the envir_stacomi
-	assign("datawd", datawd, envir = envir_stacomi)
-	assign("sch", paste(sch, ".", sep = ""), envir = envir_stacomi)
-	load_stacomi()
-	invisible(NULL)
+stacomi <- function(database_expected = TRUE,
+                    datawd = tempdir(),
+                    sch = "test") {
+  assign("database_expected", database_expected, envir = envir_stacomi)
+  # values assigned in the envir_stacomi
+  assign("datawd", datawd, envir = envir_stacomi)
+  assign("sch", paste(sch, ".", sep = ""), envir = envir_stacomi)
+  load_stacomi()
+  invisible(NULL)
 }
 
 
@@ -135,7 +142,7 @@ stacomi = function(database_expected = TRUE,  datawd = "~", sch = "test") {
 
 
 #' Working environment for stacomiR created when launching stacomi()
-#' 
+#'
 #' This is where the graphical interface stores its objects
 #' try \code{ls(envir=envir_stacomi)}
 #' @keywords environment
diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R
index 7fa4135..1863ef2 100644
--- a/tests/testthat/helper.R
+++ b/tests/testthat/helper.R
@@ -3,13 +3,7 @@
 # this file is called before testhat so funcion will be available in all test
 # https://testthat.r-lib.org/articles/test-fixtures.html#withr-defer-
 # could have used with_envvar and local_envvar but had to set them each time
-# options(
-#   stacomiR.dbname = "bd_contmig_nat",
-#   stacomiR.host = "localhost",
-#   stacomiR.port = "5432",
-#   stacomiR.user = "stacomi_test",
-#   stacomiR.password = "stacomi_test"
-# )
+
 password <- getOption("stacomiR.password") # if not set will be ""
 dbname <- getOption("stacomiR.dbname") # if not set will be ""
 user <- getOption("stacomiR.user")
diff --git a/tests/testthat/test-03-report_df.R b/tests/testthat/test-03-report_df.R
index 06ed6b4..bf4b0a4 100644
--- a/tests/testthat/test-03-report_df.R
+++ b/tests/testthat/test-03-report_df.R
@@ -1,95 +1,99 @@
 context("report_df")
 
 test_that("Test an instance of report_df", {
-			skip_on_cran()
-			stacomi(database_expected = FALSE, sch ="test")
-			env_set_test_stacomi()
-			r_df <- new("report_df")
-			r_df <- choice_c(
-					r_df,
-					2,
-					horodatedebut = "2013-01-01",
-					horodatefin = "2013-12-31",
-					silent = TRUE
-			)
-			expect_gt(nrow(r_df@df@data),
-					0,
-					label = "There should be data loaded by the choice_c method in the data slot of
-							the ref_df slot,nrow(r_df@df@data)")
-			expect_s4_class(r_df,
-					"report_df")
-			expect_error(
-					BfDF <- choice_c(
-							r_df,
-							2,
-							horodatedebut = "2013 01 011",
-							horodatefin = "2013-12-31",
-							silent = TRUE
-					)
-			)
-			rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
-			
-		})
+  skip_on_cran()
+  stacomi(database_expected = FALSE, sch = "test")
+  env_set_test_stacomi()
+  r_df <- new("report_df")
+  r_df <- choice_c(
+    r_df,
+    2,
+    horodatedebut = "2013-01-01",
+    horodatefin = "2013-12-31",
+    silent = TRUE
+  )
+  expect_gt(nrow(r_df@df@data),
+    0,
+    label = "There should be data loaded by the choice_c method in the data slot of
+							the ref_df slot,nrow(r_df@df@data)"
+  )
+  expect_s4_class(
+    r_df,
+    "report_df"
+  )
+  expect_error(
+    BfDF <- choice_c(
+      r_df,
+      2,
+      horodatedebut = "2013 01 011",
+      horodatefin = "2013-12-31",
+      silent = TRUE
+    )
+  )
+  rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
+})
 
 test_that("report_df charge method works", {
-			skip_on_cran()
-			stacomi(database_expected = TRUE, sch ="test")
-			env_set_test_stacomi()
-			r_df <- new("report_df")
-			r_df <- choice_c(
-					r_df,
-					2,
-					horodatedebut = "2013-01-01",
-					horodatefin = "2013-12-31",
-					silent = TRUE
-			)
-			r_df <- charge(r_df, silent = TRUE)
-			r_df <- connect(r_df, silent = TRUE)
-			expect_equal(nrow(r_df@data), 5)
-			rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
-			
-		})
+  skip_on_cran()
+  stacomi(database_expected = TRUE, sch = "test")
+  env_set_test_stacomi()
+  r_df <- new("report_df")
+  r_df <- choice_c(
+    r_df,
+    2,
+    horodatedebut = "2013-01-01",
+    horodatefin = "2013-12-31",
+    silent = TRUE
+  )
+  r_df <- charge(r_df, silent = TRUE)
+  r_df <- connect(r_df, silent = TRUE)
+  expect_equal(nrow(r_df@data), 5)
+  rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
+})
 
 
 test_that("report_df plot method works", {
-			stacomi(database_expected = FALSE, sch ="test")
-			data(r_df)
-			r_df <- r_df
-			# expect_error(expr,NA) tests for an absence of error
-			expect_no_error({
-						invisible(capture.output(plot(r_df, plot.type = "1", silent = TRUE)))
-						invisible(capture.output(plot(r_df,
-								plot.type = "2",
-								silent = TRUE,
-								main = "An example title")))
-						plot(r_df,
-								plot.type = "3",
-								silent = TRUE,
-								main = "An example title")
-						plot(r_df,
-								plot.type = "4",
-								silent = TRUE,
-								main = "An example title")})
-			rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
-		})
-
+  stacomi(database_expected = FALSE, sch = "test")
+  data(r_df)
+  r_df <- r_df
+  # expect_error(expr,NA) tests for an absence of error
+  expect_no_error({
+    invisible(capture.output(plot(r_df, plot.type = "1", silent = TRUE)))
+    invisible(capture.output(plot(r_df,
+      plot.type = "2",
+      silent = TRUE,
+      main = "An example title"
+    )))
+    plot(r_df,
+      plot.type = "3",
+      silent = TRUE,
+      main = "An example title"
+    )
+    plot(r_df,
+      plot.type = "4",
+      silent = TRUE,
+      main = "An example title"
+    )
+  })
+  rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
+})
 
 test_that("report_df summary method works", {
-			skip_on_cran()
-			stacomi(database_expected = FALSE, sch ="test")
-			data(r_df)
-			r_df <- r_df
-			#expected <- ifelse(Sys.getlocale(category = "LC_TIME")=="French_France.utf8", "statistiques", "summary")
-			expect_output(summary(r_df, silent = TRUE))
-			rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
-		})
+  skip_on_cran()
+  stacomi(database_expected = FALSE, sch = "test")
+  data(r_df)
+  # r_df <- r_df
+  # expected <- ifelse(Sys.getlocale(category = "LC_TIME")=="French_France.utf8", "statistiques", "summary")
+  expect_output(summary(r_df, silent = TRUE))
+  rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
+})
 
 
 test_that("report_df print method works", {
-			skip_on_cran()
-			stacomi(database_expected = FALSE, sch ="test")
-			data(r_df)
-			r_df <- r_df
-			expect_output(print(r_df))
-			rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
-		})
\ No newline at end of file
+  skip_on_cran()
+  stacomi(database_expected = FALSE, sch = "test")
+  data(r_df)
+  r_df <- r_df
+  expect_output(print(r_df))
+  rm(list = ls(envir = envir_stacomi), envir = envir_stacomi)
+})
diff --git a/tests/testthat/test-05-report_sample_char.R b/tests/testthat/test-05-report_sample_char.R
index 87128d4..680d7f0 100644
--- a/tests/testthat/test-05-report_sample_char.R
+++ b/tests/testthat/test-05-report_sample_char.R
@@ -5,7 +5,7 @@ test_that("Test that view lot_ope_car exists", {
   stacomi(database_expected = TRUE, sch = "test")
   req <- new("RequeteDB")
   sch <- rlang::env_get(envir_stacomi, "sch")
-  req@sql <- paste("select * from ", sch, " vue_lot_ope_car limit 10")
+  req@sql <- paste("select * from ", sch, "vue_lot_ope_car limit 10")
   req <- stacomirtools::query(req)
   result <- req@query
   expect_true(nrow(result) > 0)
@@ -80,8 +80,8 @@ test_that("Test charge method for report_sample_char", {
       taxa = c("Anguilla anguilla"),
       stage = c("AGJ", "CIV"),
       par = c(1785, 1786, 1787, "C001"),
-      horodatedebut = "2013-01-01",
-      horodatefin = "2013-12-31",
+      horodatedebut = "2009-01-01",
+      horodatefin = "2009-12-31",
       silent = TRUE
     )
   )
-- 
GitLab


From c23a3add1d893b9ead97dded7856ee145bb56e56 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Sat, 1 Mar 2025 17:35:00 +0100
Subject: [PATCH 07/13] up

---
 R/stacomi.R     | 2 +-
 dev/03_deploy.R | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/R/stacomi.R b/R/stacomi.R
index 253e23a..3e3bc51 100644
--- a/R/stacomi.R
+++ b/R/stacomi.R
@@ -110,7 +110,7 @@ load_stacomi <- function(...) {
 #' require(stacomiR)
 #' # launch stacomi
 #' \dontrun{
-#' stacomi(database_expected = TRUE, datawd = "~", sch = "iav")
+#' stacomi(database_expected = TRUE, datawd = tempdir(), sch = "iav")
 #' }
 #' # launch stacomi without connection to the database
 #' stacomi(database_expected = FALSE)
diff --git a/dev/03_deploy.R b/dev/03_deploy.R
index bd41850..6346d20 100644
--- a/dev/03_deploy.R
+++ b/dev/03_deploy.R
@@ -18,7 +18,13 @@ rm(list = ls(all.names = TRUE))
 devtools::load_all()
 Sys.setenv("LANGUAGE" = "en") # otherwise problems when running from Rstudio
 
-# GO TO helper.R called before everything to change options.
+options(
+  stacomiR.dbname = "bd_contmig_nat",
+  stacomiR.host = "localhost",
+  stacomiR.port = "5432",
+  stacomiR.user = "stacomi_test",
+  stacomiR.password = "stacomi_test"
+)
 devtools::test() # this will run load_all() see details about classes below for specific tests
 #test_local() # check a package during R CMD check
 test <- capture.output(devtools::test(reporter="junit")) 
-- 
GitLab


From d0fa62348e8f4d080882e41ebffa2f66cda6aa22 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Sat, 1 Mar 2025 17:52:37 +0100
Subject: [PATCH 08/13] MAJ doc

---
 man/choice_c-report_annual-method.Rd       |   2 +-
 man/plot-report_mig_mult-missing-method.Rd |   2 +-
 man/r_dc.Rd                                |   2 +-
 man/r_df.Rd                                |   2 +-
 man/r_env.Rd                               |   2 +-
 man/r_mig.Rd                               |   2 +-
 man/r_mig_interannual_vichy.Rd             |   2 +-
 man/report_annual-class.Rd                 |   8 +-
 man/report_dc-class.Rd                     |  77 +++---
 man/report_df-class.Rd                     |  68 +++--
 man/report_env-class.Rd                    |  50 ++--
 man/report_ge_weight-class.Rd              |  79 +++---
 man/report_mig-class.Rd                    |  83 +++---
 man/report_mig_char-class.Rd               |  94 +++----
 man/report_mig_env-class.Rd                |  67 ++---
 man/report_mig_interannual-class.Rd        | 289 +++++++++++----------
 man/report_mig_mult-class.Rd               |   4 +-
 man/report_sample_char-class.Rd            | 129 ++++-----
 man/report_sea_age-class.Rd                |  74 +++---
 man/report_silver_eel-class.Rd             |  72 ++---
 man/report_species-class.Rd                |  75 +++---
 man/stacomi.Rd                             |  22 +-
 22 files changed, 624 insertions(+), 581 deletions(-)

diff --git a/man/choice_c-report_annual-method.Rd b/man/choice_c-report_annual-method.Rd
index 9c5834c..4ef9ffb 100644
--- a/man/choice_c-report_annual-method.Rd
+++ b/man/choice_c-report_annual-method.Rd
@@ -27,7 +27,7 @@ it should match the ref.tr_taxon_tax referential table in the stacomi database,
 An object of class \link{report_annual-class} with data selected
 }
 \description{
-The choice_c method fills in the data slot for classes \link{ref_dc-class}, \link{ref_taxa-class}, 
+The choice_c method fills in the data slot for classes \link{ref_dc-class}, \link{ref_taxa-class},
 \link{ref_stage-class} and two slots of \link{ref_year-class}
 }
 \author{
diff --git a/man/plot-report_mig_mult-missing-method.Rd b/man/plot-report_mig_mult-missing-method.Rd
index a8cc9b4..183d05f 100644
--- a/man/plot-report_mig_mult-missing-method.Rd
+++ b/man/plot-report_mig_mult-missing-method.Rd
@@ -17,7 +17,7 @@
 \arguments{
 \item{x}{An object of class report_mig_mult}
 
-\item{plot.type}{One of 'standard','step','multiple'. Defaut to \code{standard} the standard report_mig with dc and operation displayed, can also be \code{step} or 
+\item{plot.type}{One of 'standard','step','multiple','time'. Defaut to \code{standard} the standard report_mig with dc and operation displayed, can also be \code{step} or 
 \code{multiple}}
 
 \item{color}{Default NULL, argument passed for the plot.type='standard' method. A vector of color in the following order : (1) working, (2) stopped, (3:7) 1...5 types of operation,
diff --git a/man/r_dc.Rd b/man/r_dc.Rd
index 14aaa53..3f39384 100644
--- a/man/r_dc.Rd
+++ b/man/r_dc.Rd
@@ -24,7 +24,7 @@ An object of class report_dc with 4 slots:
     \item{libelle}{label corresponding to per_tar_code}
            }
        }
-  \item{df}{the \code{ref_dc} object with 3 slots filled with data corresponding to the iav postgres schema}
+  \item{df}{the \code{ref_dc} object with 3 slots filled with data corresponding to the test postgres schema}
   \item{horodatedebut}{the \code{ref_horodate} with horodate set for starting date}
   \item{horodatefin}{the \code{ref_horodate} with horodate set for ending date}   
 }
diff --git a/man/r_df.Rd b/man/r_df.Rd
index 0fcd7c6..10c82e4 100644
--- a/man/r_df.Rd
+++ b/man/r_df.Rd
@@ -23,7 +23,7 @@ An object of class report_df with 4 slots:
     \item{libelle}{label corresponding to per_tar_code}
            }
        }
-  \item{df}{the \code{ref_df} object with 3 slots filled with data corresponding to the iav postgres schema}
+  \item{df}{the \code{ref_df} object with 3 slots filled with data corresponding to the test postgres schema}
   \item{horodatedebut}{the \code{ref_horodate} with horodate set for starting date}
   \item{horodatefin}{the \code{ref_horodate} with horodate set for ending date}'   
 }
diff --git a/man/r_env.Rd b/man/r_env.Rd
index d2e8aa9..31b8e89 100644
--- a/man/r_env.Rd
+++ b/man/r_env.Rd
@@ -7,7 +7,7 @@
 \format{
 An object of class \link{report_env-class} with data slot loaded:
 \describe{
-  \item{stationMesure}{the \code{ref_env} object with 5 slots filled with data corresponding to the iav postgres schema}
+  \item{stationMesure}{the \code{ref_env} object with 5 slots filled with data corresponding to the test postgres schema}
   \item{horodatedebut}{object of class \code{ref_horodate-class} : the start date selected}
   \item{horodatefin}{object of class \code{ref_horodate-class} : the end date selected}
   \item{data}{ A dataframe with 723 rows and 6 variables
diff --git a/man/r_mig.Rd b/man/r_mig.Rd
index e3f0e66..9b72c2e 100644
--- a/man/r_mig.Rd
+++ b/man/r_mig.Rd
@@ -7,7 +7,7 @@
 \format{
 An object of class report_mig with 8 slots:
 \describe{
-  \item{dc}{the \code{ref_dc} object with 4 slots filled with data corresponding to the iav postgres schema}
+  \item{dc}{the \code{ref_dc} object with 4 slots filled with data corresponding to the test postgres schema}
   \item{taxa}{the \code{ref_taxa} the taxa selected}
   \item{stage}{the \code{ref_stage} the stage selected}
   \item{timestep}{the \code{ref_timestep_daily} calculated for all 2015}
diff --git a/man/r_mig_interannual_vichy.Rd b/man/r_mig_interannual_vichy.Rd
index 7f062d3..0bbc2c5 100644
--- a/man/r_mig_interannual_vichy.Rd
+++ b/man/r_mig_interannual_vichy.Rd
@@ -7,7 +7,7 @@
 \format{
 An object of class \link{report_mig_interannual-class} with 7 slots:
 \describe{
-  \item{dc}{the \code{ref_dc} object with 4 slots filled with data corresponding to the iav postgres schema}
+  \item{dc}{the \code{ref_dc} object with 4 slots filled with data corresponding to the test postgres schema}
   \item{taxa}{the \code{ref_taxa} the taxa selected}
   \item{stage}{the \code{ref_stage} the stage selected}
   \item{start_year}{the \code{ref_timestep_daily} calculated for all 2015}
diff --git a/man/report_annual-class.Rd b/man/report_annual-class.Rd
index 515e871..d795f3a 100644
--- a/man/report_annual-class.Rd
+++ b/man/report_annual-class.Rd
@@ -28,11 +28,11 @@ ref_year allows to choose last year of the report}
 \examples{
 # launching stacomi without database for demo
 stacomi(database_expected=FALSE)
-# the following piece of script will load the Arzal dataset and connected to iav postgres schema
+# the following piece of script will load the Arzal dataset and connected to test postgres schema
 # it requires a working database
 # prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
-	stacomi(database_expected=TRUE, sch='iav')
+	stacomi(database_expected=TRUE, sch='test')
 	if (interactive()){
 		if (!exists("user")){
 			user <- readline(prompt="Enter user: ")
@@ -51,8 +51,8 @@ stacomi(database_expected=FALSE)
 	  dc=c(5,6,12),
 	  taxa=c("Anguilla anguilla"),
 	  stage=c("AGJ","AGG"),
-	  start_year="1996",
-	  end_year="2015",
+	  start_year="2012",
+	  end_year="2013",
 	  silent=FALSE)
   r_ann<-connect(r_ann)	
 }
diff --git a/man/report_dc-class.Rd b/man/report_dc-class.Rd
index fb0d806..88ef5bd 100644
--- a/man/report_dc-class.Rd
+++ b/man/report_dc-class.Rd
@@ -29,55 +29,50 @@ class allows to draw graphics allowing an overview of the device operation
 }
 
 \examples{
-
-
-# An example that will work only if the database is present 
-# and the program installed and comprises the schema iav
+# An example that will work only if the database is present
+# and the program installed and comprises the schema test
 # prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
+if (interactive()) {
+  if (!exists("user")) {
+    user <- readline(prompt = "Enter user: ")
+    password <- readline(prompt = "Enter password: ")
+  }
 
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.password = password						
-	)	
+  options(
+    stacomiR.dbname = "bd_contmig_nat",
+    stacomiR.host = "localhost",
+    stacomiR.port = "5432",
+    stacomiR.user = user,
+    stacomiR.password = password
+  )
+  }
+  stacomi(TRUE, sch = "test")
+  r_dc <- new("report_dc")
+  r_dc <- choice_c(r_dc,
+    5,
+    horodatedebut = "2012-01-01",
+    horodatefin = "2015-12-31",
+    silent = TRUE
+  )
+  r_dc <- connect(r_dc)
 }
- stacomi(TRUE,sch="iav")
-  r_dc=new("report_dc")
-  r_dc<-choice_c(r_dc,
-	  5,
-	  horodatedebut="2000-01-01",
-	  horodatefin="2015-12-31",
-	  silent=TRUE)
-  r_dc<-connect(r_dc)
+  ##
 
-##
-	
   # this dataset has been loaded by the previous lines
-  ###########################################################	
-# Without connexion to the database (use dataset r_dc)
+  ###########################################################
+  # Without connexion to the database (use dataset r_dc)
   ##########################################################
-	# this option allows to launch the program without the interface to display 
-# some of the program features.
-	stacomi(database_expected=FALSE)
+  # this option allows to launch the program without the interface to display
+  # some of the program features.
+  stacomi(database_expected = FALSE)
   data("r_dc")
-  plot(r_dc,plot.type="1")
-  plot(r_dc,plot.type="2")
-  plot(r_dc,plot.type="3",main="trial title")
-  plot(r_dc,plot.type="4",main="trial title")
-# the following will write in the datawd folder
-   summary(r_dc)
-}
-
-
-
+  plot(r_dc, plot.type = "1")
+  plot(r_dc, plot.type = "2")
+  plot(r_dc, plot.type = "3", main = "trial title")
+  plot(r_dc, plot.type = "4", main = "trial title")
+  # the following will write in the datawd folder
+  summary(r_dc)
 
 }
 \seealso{
diff --git a/man/report_df-class.Rd b/man/report_df-class.Rd
index c0c1d8d..f7a266a 100644
--- a/man/report_df-class.Rd
+++ b/man/report_df-class.Rd
@@ -38,52 +38,46 @@ the status of either the fishway or DC. In the database four types of operation
 
 \examples{
 stacomi(
-	database_expected=FALSE)
-# An example that will work with the database installed only and schema iav in the database
+  database_expected = FALSE
+)
+# An example that will work with the database installed only and schema test in the database
 # prompt for user and password but you can set appropriate options for host, port and dbname
 
 \dontrun{
-	stacomi(
-			database_expected=TRUE, sch='iav')	
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
-  r_df=new("report_df")
-  r_df<-choice_c(r_df,
-	  1,
-	  horodatedebut="2015-01-01",
-	  horodatefin="2015-12-31",
-	  silent=TRUE)
-  Sys.setenv(TZ='GMT')
-  # the times at Arzal are recorded continuously
-  # they are converted to date when a time appears while the hour is changing
-  # hence the following
-  r_df<-connect(r_df)
+stacomi(
+  database_expected = TRUE, sch = "test"
+)
+if (interactive()) {
+  if (!exists("user")) {
+    user <- readline(prompt = "Enter user: ")
+    password <- readline(prompt = "Enter password: ")
+  }
+}
+options(
+  stacomiR.dbname = "bd_contmig_nat",
+  stacomiR.host = "localhost",
+  stacomiR.port = "5432",
+  stacomiR.user = user,
+  stacomiR.user = password
+)
+r_df <- new("report_df")
+r_df <- choice_c(r_df,
+  1,
+  horodatedebut = "2015-01-01",
+  horodatefin = "2015-12-31",
+  silent = TRUE
+)
+r_df <- connect(r_df)
 }
 
 data("r_df")
-plot(r_df,plot.type="4")
+plot(r_df, plot.type = "4")
 # the following examples work but take a while to compute
 \dontrun{
-  plot(r_df,plot.type="1")
-  plot(r_df,plot.type="2",main="A nice title")
-  plot(r_df,plot.type="3",main="A nice title")	
+plot(r_df, plot.type = "1")
+plot(r_df, plot.type = "2", main = "A nice title")
+plot(r_df, plot.type = "3", main = "A nice title")
 }
-
-
-
-
-
 }
 \seealso{
 Other report Objects: 
diff --git a/man/report_env-class.Rd b/man/report_env-class.Rd
index dc7be72..a8d7273 100644
--- a/man/report_env-class.Rd
+++ b/man/report_env-class.Rd
@@ -24,33 +24,35 @@ joined graphs crossing the information from \link{report_mig_mult-class} and \li
 
 \examples{
 stacomi(
-	database_expected=FALSE)
+  database_expected = FALSE
+)
 \dontrun{
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
-  r_env<-new("report_env")
-  r_env<-choice_c(r_env,
-	  stationMesure=c("temp_gabion","coef_maree"),
-	  datedebut="2008-01-01",
-	  datefin="2008-12-31",
-	  silent=FALSE)	
-  r_env<-connect(r_env)
-  
-}	
+if (interactive()) {
+  if (!exists("user")) {
+    user <- readline(prompt = "Enter user: ")
+    password <- readline(prompt = "Enter password: ")
+  }
+}
+options(
+  stacomiR.dbname = "bd_contmig_nat",
+  stacomiR.host = "localhost",
+  stacomiR.port = "5432",
+  stacomiR.user = user,
+  stacomiR.user = password
+)
+r_env <- new("report_env")
+r_env <- choice_c(r_env,
+  stationMesure = c("temp_gabion", "coef_maree"),
+  datedebut = "2008-01-01",
+  datefin = "2008-12-31",
+  silent = FALSE
+)
+r_env <- connect(r_env)
+
+}
 
 data("r_env")
-plot(r_env,silent=TRUE)
+plot(r_env, silent = TRUE)
 }
 \seealso{
 Other report Objects: 
diff --git a/man/report_ge_weight-class.Rd b/man/report_ge_weight-class.Rd
index 53b2e3a..9c356a6 100644
--- a/man/report_ge_weight-class.Rd
+++ b/man/report_ge_weight-class.Rd
@@ -50,55 +50,58 @@ request are from august to august (a glass eel season)
 require(stacomiR)
 # launching stacomi without selecting the scheme or interface
 stacomi(
-	database_expected=FALSE, sch='iav')
-# this requires a working database with the schema iav
+    database_expected = FALSE, sch = "test"
+)
+# this requires a working database with the schema test
 # prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
-	stacomi(
-			database_expected=TRUE, sch='iav')	
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
-  #create an instance of the class
-  r_gew<-new("report_ge_weight")
-  r_gew@liste<-charge(object=r_gew@liste,listechoice=c("=1",">1","tous"),label="")
-  # here I'm using weights when number are larger than 1i.e.wet weight
-  # always choose a date from one year to the next eg 2010 to 2011
-  # as the dates are from august to august
-  r_gew<-choice_c(r_gew,
-	  dc=c(6),			
-	  start_year="2009",
-	  end_year="2015",
-	  selectedvalue=">1",
-	  silent=FALSE)
-  r_gew<-connect(r_gew)	
-  r_gew<-calcule(r_gew)
-}	
+stacomi(
+    database_expected = TRUE, sch = "test"
+)
+if (interactive()) {
+    if (!exists("user")) {
+        user <- readline(prompt = "Enter user: ")
+        password <- readline(prompt = "Enter password: ")
+    }
+}
+options(
+    stacomiR.dbname = "bd_contmig_nat",
+    stacomiR.host = "localhost",
+    stacomiR.port = "5432",
+    stacomiR.user = user,
+    stacomiR.user = password
+)
+# create an instance of the class
+r_gew <- new("report_ge_weight")
+r_gew@liste <- charge(object = r_gew@liste, listechoice = c("=1", ">1", "tous"), label = "")
+# here I'm using weights when number are larger than 1i.e.wet weight
+# always choose a date from one year to the next eg 2010 to 2011
+# as the dates are from august to august
+r_gew <- choice_c(r_gew,
+    dc = c(6),
+    start_year = "2009",
+    end_year = "2014",
+    selectedvalue = ">1",
+    silent = FALSE
+)
+r_gew <- connect(r_gew)
+r_gew <- calcule(r_gew)
+}
 # load the dataset generated by previous lines
 data("r_gew")
 # the calculation will fill the slot calcdata
 
 # A ggplot showing the trend in weight
-plot(r_gew, plot.type=1)
+plot(r_gew, plot.type = 1)
 # A plot showing both the data and the trend as recorded in the database
-plot(r_gew, plot.type=2)
+plot(r_gew, plot.type = 2)
 # Same as plot.type=1 but with size according to size of the sample,
 # usefull for wet weights where weight are recorded on a number of glass eel
-plot(r_gew, plot.type=3)
+plot(r_gew, plot.type = 3)
 \dontrun{
-# First model with nls, see Guerault and Desaunay (1993) 
-  model(r_gew,model.type="seasonal")
-  model(r_gew,model.type="seasonal1")
+# First model with nls, see Guerault and Desaunay (1993)
+model(r_gew, model.type = "seasonal")
+model(r_gew, model.type = "seasonal1")
 }
 }
 \seealso{
diff --git a/man/report_mig-class.Rd b/man/report_mig-class.Rd
index c1435c6..9149cba 100644
--- a/man/report_mig-class.Rd
+++ b/man/report_mig-class.Rd
@@ -37,75 +37,82 @@ method if any weight are found in the data slot.}
 In practise, the report_mig class uses methods (calcule, connect...) from the more elaborate \link{report_mig_mult-class}
 }
 \examples{
-stacomi(database_expected=FALSE) 
+stacomi(database_expected = FALSE)
 # If you have a working database
-# the following line of code will create the r_mig dataset from the iav (default) 
+# the following line of code will create the r_mig dataset from the test (default) 
 # schema in the database
-\dontrun{	
-	stacomi(database_expected=TRUE)	
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
-  stacomi(
-	  database_expected=TRUE)	
-  r_mig=new("report_mig")
-  r_mig=choice_c(r_mig,
-	  dc=5,
-	  taxa=c("Chelon ramada"),
-	  stage=c("IND"),
-	  datedebut="2015-01-01",
-	  datefin="2015-12-31")
-  r_mig<-charge(r_mig)
+\dontrun{
+  stacomi(database_expected = TRUE)
+  if (interactive()) {
+    if (!exists("user")) {
+      user <- readline(prompt = "Enter user: ")
+      password <- readline(prompt = "Enter password: ")
+    }
+  }
+  options(
+    stacomiR.dbname = "bd_contmig_nat",
+    stacomiR.host = "localhost",
+    stacomiR.port = "5432",
+    stacomiR.user = user,
+    stacomiR.user = password
+  )
+  stacomi(database_expected = TRUE)
+  r_mig = new("report_mig")
+  r_mig = choice_c(
+    r_mig,
+    dc = 5,
+    taxa = c("Chelon ramada"),
+    stage = c("IND"),
+    datedebut = "2015-01-01",
+    datefin = "2015-12-31"
+  )
+  r_mig <- charge(r_mig)
   # launching charge will also load classes associated with the report
   # e.g. report_ope, report_df, report_dc
-  r_mig<-connect(r_mig)
+  r_mig <- connect(r_mig)
   ########################
-# calculations
+  # calculations
   ########################
-  r_mig<-calcule(r_mig,silent=TRUE)
+  r_mig <- calcule(r_mig, silent = TRUE)
 }
 ########################
 # loading data
 ## use the following to get the raw data loaded by the connect method
 # not shown there as the database and program might not be installed
-# All three classes report... were created by the charge and connect method 
+# All three classes report... were created by the charge and connect method
 # of report_mig_mult
 # in the previous example
 ################################
 data("r_mig")
 data("r_mig_ope")
-assign("report_ope",r_mig_ope,envir=envir_stacomi)
+assign("report_ope", r_mig_ope, envir = envir_stacomi)
 data("r_mig_df")
-assign("report_df",r_mig_df,envir=envir_stacomi)
+assign("report_df", r_mig_df, envir = envir_stacomi)
 data("r_mig_dc")
-assign("report_dc",r_mig_dc,envir=envir_stacomi)
+assign("report_dc", r_mig_dc, envir = envir_stacomi)
 
 
 #Individual plot for all DC (standard), taxa and stage where data present
 #silent argument to stop all messages
-plot(r_mig,plot.type="standard",silent=TRUE)
+plot(r_mig, plot.type = "standard", silent = TRUE)
 #cumulated migration at the station (all stages and DC grouped)
-plot(r_mig,plot.type="step")
+plot(r_mig, plot.type = "step")
 
 # data will be written in the data directory specified in datawd argument to stacomi default "~"
 #file
 
 \dontrun{
-  summary(r_mig,silent=TRUE)
+  summary(r_mig, silent = TRUE)
 }
 # this will write the daily report for later in in the reportnMigrationInterannuelle-class
 \dontrun{
-  write_database(r_mig,silent=TRUE,dbname="bd_contmig_nat",host="localhost",port=5432)
+  write_database(
+    r_mig,
+    silent = TRUE,
+    dbname = "bd_contmig_nat",
+    host = "localhost",
+    port = 5432
+  )
 }
 }
 \seealso{
diff --git a/man/report_mig_char-class.Rd b/man/report_mig_char-class.Rd
index 09354e2..2bc863b 100644
--- a/man/report_mig_char-class.Rd
+++ b/man/report_mig_char-class.Rd
@@ -54,62 +54,66 @@ using interface_report_mig_char function.
 require(stacomiR)
 
 stacomi(
-	database_expected=FALSE, sch='logrami')
+  database_expected = FALSE
+)
 # this requires a database with the schema logrami
 # prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
-	stacomi(database_expected=TRUE, sch='logrami')	
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
-  r_mig_char <- new("report_mig_char")
-  # here parqual is not in the list
-  # so this is equivalent to parqual=NULL
-  # default for echantillon is "with"
-  r_mig_char <- choice_c(r_mig_char,
-	  dc=c(107,108,101),
-	  taxa=c("Salmo salar"),
-	  stage=c('5','11','BEC','BER','IND'),
-	  parquan=c('C001','1786','1785'),
-	  horodatedebut="2012-01-01",
-	  horodatefin="2012-12-31",
-	  silent=FALSE)
-  # r_mig_char<-charge(r_mig_char) not necessary there
-  r_mig_char <- connect(r_mig_char)
-  
-}	
+stacomi(database_expected = TRUE, sch = "test")
+if (interactive()) {
+  if (!exists("user")) {
+    user <- readline(prompt = "Enter user: ")
+    password <- readline(prompt = "Enter password: ")
+  }
+}
+options(
+  stacomiR.dbname = "bd_contmig_nat",
+  stacomiR.host = "localhost",
+  stacomiR.port = "5432",
+  stacomiR.user = user,
+  stacomiR.user = password
+)
+r_mig_char <- new("report_mig_char")
+# here parqual is not in the list
+# so this is equivalent to parqual=NULL
+# default for echantillon is "with"
+r_mig_char <- choice_c(r_mig_char,
+  dc = c(19,20),
+  taxa = c("Salmo salar"),
+  stage = c("5"),
+  parquan = c("C001"),
+  horodatedebut = "2012-01-01",
+  horodatefin = "2012-12-31",
+  silent = FALSE
+)
+# r_mig_char<-charge(r_mig_char) not necessary there
+r_mig_char <- connect(r_mig_char)
+
+}
 # load the dataset generated by previous lines
 data("r_mig_char")
 
-r_mig_char<-calcule(r_mig_char, silent=TRUE)
-plot(r_mig_char,plot.type="quant", silent=TRUE)
+r_mig_char <- calcule(r_mig_char, silent = TRUE)
+plot(r_mig_char, plot.type = "quant", silent = TRUE)
 # one quantitative parameter found, manual choice of color
-plot(r_mig_char,plot.type="quant",color_parm=c("C001"="red"), silent=TRUE)
+plot(r_mig_char, plot.type = "quant", color_parm = c("C001" = "red"), silent = TRUE)
 # age will be plotted as a qualitative variable
 # here we split size data accoding to the limit known between different ages from
 # scale reading in the Loire
-r_mig_char <- setasqualitative(r_mig_char,par='C001',
-		breaks=c(0,675,850,2000),
-		labels=c("age 1","age 2","age 3"))
-r_mig_char<-calcule(r_mig_char, silent=TRUE)
-plot(r_mig_char, plot.type="qual", silent=TRUE)
-plot(r_mig_char, plot.type="crossed")
-plot(r_mig_char, plot.type="crossed",
-    color_parm=c("age 1"="#379ec6","age 2"="#173957","age 3"="#b09953"))
-xt<-xtable(r_mig_char)
+r_mig_char <- setasqualitative(r_mig_char,
+  par = "C001",
+  breaks = c(0, 675, 850, 2000),
+  labels = c("age 1", "age 2", "age 3")
+)
+r_mig_char <- calcule(r_mig_char, silent = TRUE)
+plot(r_mig_char, plot.type = "qual", silent = TRUE)
+plot(r_mig_char, plot.type = "crossed")
+plot(r_mig_char,
+  plot.type = "crossed",
+  color_parm = c("age 1" = "#379ec6", "age 2" = "#173957", "age 3" = "#b09953")
+)
+xt <- xtable(r_mig_char)
 # use method print.xtable to get the output
-
-
 }
 \seealso{
 Other report Objects: 
diff --git a/man/report_mig_env-class.Rd b/man/report_mig_env-class.Rd
index 330916b..06aa144 100644
--- a/man/report_mig_env-class.Rd
+++ b/man/report_mig_env-class.Rd
@@ -28,45 +28,48 @@ event of the day is displayed on the annual plot.
 \examples{
 require(stacomiR)
 stacomi(
-	database_expected=FALSE)
+  database_expected = FALSE
+)
 # the following will load the data provided the user has access to the database
-# with data in the iav example scheme.
+# with data in the test example scheme.
 # prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
-	stacomi(
-			database_expected=TRUE)	
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
-  r_mig_env<-new("report_mig_env")
-  r_mig_env<-choice_c(r_mig_env,
-	  dc=c(5,6,12),
-	  taxa=c("Anguilla anguilla"),
-	  stage=c("AGJ","AGG","CIV"),
-	  stationMesure=c("temp_gabion","coef_maree","phases_lune"),
-	  datedebut="2008-01-01",
-	  datefin="2008-12-31",
-	  silent=FALSE)	
-  r_mig_env<-charge(r_mig_env) # this is necessary to load operations, DF and DC
-  r_mig_env<-connect(r_mig_env)
-  r_mig_env<-calcule(r_mig_env,silent=TRUE)
-}	
+stacomi(
+  database_expected = TRUE
+)
+if (interactive()) {
+  if (!exists("user")) {
+    user <- readline(prompt = "Enter user: ")
+    password <- readline(prompt = "Enter password: ")
+  }
+}
+options(
+  stacomiR.dbname = "bd_contmig_nat",
+  stacomiR.host = "localhost",
+  stacomiR.port = "5432",
+  stacomiR.user = user,
+  stacomiR.user = password
+)
+r_mig_env <- new("report_mig_env")
+r_mig_env <- choice_c(r_mig_env,
+  dc = c(5, 6, 12),
+  taxa = c("Anguilla anguilla"),
+  stage = c("AGJ", "AGG", "CIV"),
+  stationMesure = c("temp_gabion", "coef_maree", "phases_lune"),
+  datedebut = "2010-01-01",
+  datefin = "2010-12-31",
+  silent = FALSE
+)
+r_mig_env <- charge(r_mig_env) # this is necessary to load operations, DF and DC
+r_mig_env <- connect(r_mig_env)
+r_mig_env <- calcule(r_mig_env, silent = TRUE)
+}
 
 data("r_mig_env")
 # An example of plot with custom colors.
 plot(r_mig_env,
-	color_station=c("temp_gabion"="red","coef_maree"="blue","phases_lune"="pink"),
- 	color_dc=c("5"="yellow","6"="orange","12"="purple")
+  color_station = c("temp_gabion" = "red", "coef_maree" = "blue", "phases_lune" = "pink"),
+  color_dc = c("5" = "yellow", "6" = "orange", "12" = "purple")
 )
 }
 \seealso{
diff --git a/man/report_mig_interannual-class.Rd b/man/report_mig_interannual-class.Rd
index 6b57353..19f47d3 100644
--- a/man/report_mig_interannual-class.Rd
+++ b/man/report_mig_interannual-class.Rd
@@ -40,182 +40,199 @@ ref_year allows to choose last year of the report}
 require(stacomiR)
 # launching stacomi without selecting the scheme or interface
 stacomi(
-	database_expected=FALSE, sch='pmp')
-# If you have connection to the database with the pmp scheme 
+  database_expected = FALSE, sch = "pmp"
+)
+# If you have connection to the database with the pmp scheme
 # prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
-	stacomi(database_expected=TRUE, sch="pmp")	
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
+stacomi(database_expected = TRUE, sch = "pmp")
+if (interactive()) {
+  if (!exists("user")) {
+    user <- readline(prompt = "Enter user: ")
+    password <- readline(prompt = "Enter password: ")
+  }
+}
+options(
+  stacomiR.dbname = "bd_contmig_nat",
+  stacomiR.host = "localhost",
+  stacomiR.port = "5432",
+  stacomiR.user = user,
+  stacomiR.user = password
+)
 
-  # (longest historical dataset available
-  # in France for eel ...) this suppose you have access to the pmp schema...
-  # a glimpse of the dataset is still available in the r_mig_interannual dataset 
-  # loaded in the package...
-  r_mig_interannual <- new("report_mig_interannual")
-  r_mig_interannual <- choice_c(r_mig_interannual,
-	  dc=c(16),
-	  taxa=c("Anguilla anguilla"),
-	  stage=c("PANG"),
-	  start_year="1990",
-	  end_year="2015",
-    year_choice=NULL,
-	  silent=TRUE)
-  r_mig_interannual <- charge(r_mig_interannual)
-  r_mig_interannual <- connect(r_mig_interannual, check=TRUE)	
-  r_mig_interannual <- calcule(r_mig_interannual, silent=TRUE)	
-}	
-#############otherwise use this ######################
+# (longest historical dataset available
+# in France for eel ...) this suppose you have access to the pmp schema...
+# a glimpse of the dataset is still available in the r_mig_interannual dataset
+# loaded in the package...
+r_mig_interannual <- new("report_mig_interannual")
+r_mig_interannual <- choice_c(r_mig_interannual,
+  dc = c(16),
+  taxa = c("Anguilla anguilla"),
+  stage = c("PANG"),
+  start_year = "1990",
+  end_year = "2015",
+  silent = TRUE
+)
+r_mig_interannual <- charge(r_mig_interannual)
+r_mig_interannual <- connect(r_mig_interannual, check = TRUE)
+r_mig_interannual <- calcule(r_mig_interannual, silent = TRUE)
+}
+############# otherwise use this ######################
 # load the dataset generated by previous lines
 data("r_mig_interannual")
 
 #######################################################
-# the first plot is of little interest, it allows to see what data 
+# the first plot is of little interest, it allows to see what data
 # are available... simple lines
 # For irregular operations like those reported at the enfrenaux eel ladder....
-plot(r_mig_interannual,plot.type="line", year_choice=2015, silent=TRUE)
+plot(r_mig_interannual, plot.type = "line", year_choice = 2015, silent = TRUE)
 
 # a plot to show the seasonality, this graph may be misleading if the
 # migration is not monitored all year round. Note the y unit is not very informative
 # you need to have the viridis package loaded to run this example
-plot(r_mig_interannual,plot.type="density",year_choice=2015, silent=TRUE)
+plot(r_mig_interannual, plot.type = "density", year_choice = 2015, silent = TRUE)
+
 \dontrun{
-  if (requireNamespace("ggplot2", quietly = TRUE)&
-	  requireNamespace("viridis", quietly = TRUE)){
-	g<-get("g",envir=envir_stacomi)	
-	g+
-		ggplot2::scale_fill_manual(values=viridis::viridis(22))+
-		ggplot2::ggtitle("Saisonnalite de la migration aux Enfrenaux")
-  }
-  #############################################
+if (requireNamespace("ggplot2", quietly = TRUE) &
+  requireNamespace("viridis", quietly = TRUE)) {
+  g <- get("g", envir = envir_stacomi)
+  g +
+    ggplot2::scale_fill_manual(values = viridis::viridis(22)) +
+    ggplot2::ggtitle("Saisonnalite de la migration aux Enfrenaux")
+}
+#############################################
 # the standard plot is showing daily values
-  ###########################################
-  plot(r_mig_interannual,plot.type="standard",year_choice=2015,silent=TRUE)
+###########################################
+plot(r_mig_interannual, plot.type = "standard", year_choice = 2015, silent = TRUE)
 # Manual edition of the graph produced
-  if (requireNamespace("ggplot2", quietly = TRUE)){
-    g1<-get("g1",envir=envir_stacomi)
-    g1<-g1+ggplot2::ggtitle("Les Enfrenaux")+
-		ggplot2::scale_fill_manual(name="Source", 
-			values=c("purple","#0A0C01"),
-			labels = c("historical set","2015 values"))+
-		ggplot2::scale_colour_manual(name="Source", values="#B8EA00",
-			labels = c("historical mean"))	+
-		ggplot2::ylab("Nombre d'anguilles")
-    print(g1)
-  }
-  #########################################################
+if (requireNamespace("ggplot2", quietly = TRUE)) {
+  g1 <- get("g1", envir = envir_stacomi)
+  g1 <- g1 + ggplot2::ggtitle("Les Enfrenaux") +
+    ggplot2::scale_fill_manual(
+      name = "Source",
+      values = c("purple", "#0A0C01"),
+      labels = c("historical set", "2015 values")
+    ) +
+    ggplot2::scale_colour_manual(
+      name = "Source", values = "#B8EA00",
+      labels = c("historical mean")
+    ) +
+    ggplot2::ylab("Nombre d'anguilles")
+  print(g1)
+}
+#########################################################
 # Another graph to show a "manual" processing of the data
 # and their extraction from the data slot
-  #########################################################	
-  if (requireNamespace("ggplot2", quietly = TRUE)&
-	      requireNamespace("viridis", quietly = TRUE)){
-    dat<-fun_date_extraction(r_mig_interannual@data, # data to import
-		"bjo_jour", # name of the column where dates are found
-		annee=FALSE,
-		mois=TRUE,
-		semaine =TRUE,
-		jour_mois=FALSE)
-# sum per month
-    res<-dplyr::select(dat,bjo_valeur,bjo_annee,semaine)
-    res<-dplyr::group_by(res,bjo_annee,semaine)
-    res<-dplyr::summarize(res,effectif=sum(bjo_valeur))
-    ggplot2::ggplot(res, ggplot2::aes(x = semaine, y = bjo_annee,fill=effectif)) +
-	        ggplot2::geom_tile(colour="black") + ggplot2::coord_fixed() +
-	        viridis::scale_fill_viridis(begin=0,option="D") + ggplot2::theme_bw()+
-	        ggplot2::theme(panel.background= ggplot2::element_rect(fill = "#9360A9"),
-			panel.grid.major=ggplot2::element_line(colour="#C1DB39"),
-			panel.grid.minor=ggplot2::element_line(colour="#7DD632"))+
-	        ggplot2::ylab("year")+ggplot2::xlab("week")+
-	        ggplot2::ggtitle("Historical trend at Les Enfrenaux Eel trap")
-	
-  }
-  ###############################################
+#########################################################
+if (requireNamespace("ggplot2", quietly = TRUE) &
+  requireNamespace("viridis", quietly = TRUE)) {
+  dat <- fun_date_extraction(r_mig_interannual@data, # data to import
+    "bjo_jour", # name of the column where dates are found
+    annee = FALSE,
+    mois = TRUE,
+    semaine = TRUE,
+    jour_mois = FALSE
+  )
+  # sum per month
+  res <- dplyr::select(dat, bjo_valeur, bjo_annee, semaine)
+  res <- dplyr::group_by(res, bjo_annee, semaine)
+  res <- dplyr::summarize(res, effectif = sum(bjo_valeur))
+  ggplot2::ggplot(res, ggplot2::aes(x = semaine, y = bjo_annee, fill = effectif)) +
+    ggplot2::geom_tile(colour = "black") +
+    ggplot2::coord_fixed() +
+    viridis::scale_fill_viridis(begin = 0, option = "D") +
+    ggplot2::theme_bw() +
+    ggplot2::theme(
+      panel.background = ggplot2::element_rect(fill = "#9360A9"),
+      panel.grid.major = ggplot2::element_line(colour = "#C1DB39"),
+      panel.grid.minor = ggplot2::element_line(colour = "#7DD632")
+    ) +
+    ggplot2::ylab("year") +
+    ggplot2::xlab("week") +
+    ggplot2::ggtitle("Historical trend at Les Enfrenaux Eel trap")
+}
+###############################################
 # barchart with different splitting periods
 # the migration is displayed against seasonal data
 # extacted from all other years loaded in the report
-  ################################################
+################################################
 # available arguments for timesplit are "quinzaine" and "mois" and "semaine"
 # with the silent=TRUE argument, it's always the latest year that is selected,
 # otherwise the user is prompted with a choice, to select the year he wants
 # to compare will all others...
-  plot(r_mig_interannual,plot.type="barchart",timesplit="quinzaine",year_choice=2015,silent=TRUE)
-# Comparison with historical values. Each year and 2 weeks values 
+plot(r_mig_interannual, plot.type = "barchart", timesplit = "quinzaine", year_choice = 2015, silent = TRUE)
+# Comparison with historical values. Each year and 2 weeks values
 # is a point on the graph...
-  plot(r_mig_interannual,plot.type="pointrange",timesplit="mois",year_choice=2015,silent=TRUE)
-  ###############################################
+plot(r_mig_interannual, plot.type = "pointrange", timesplit = "mois", year_choice = 2015, silent = TRUE)
+###############################################
 # Step plot
 # different years shown in the graph
 # the current year (or the selected year if silent=FALSE)
 # is displayed with a dotted line
-  ################################################
-  plot(r_mig_interannual,plot.type="step",year_choice=2015,silent=TRUE)
-  if (requireNamespace("ggplot2", quietly = TRUE)&
-	  requireNamespace("viridis", quietly = TRUE)){
-	g<-get("g",envir=envir_stacomi)	+ ggplot2::theme_minimal()
-	g+viridis::scale_color_viridis(discrete=TRUE)+
-		ggplot2::ggtitle("Cumulated migration step plot 
+################################################
+plot(r_mig_interannual, plot.type = "step", year_choice = 2015, silent = TRUE)
+if (requireNamespace("ggplot2", quietly = TRUE) &
+  requireNamespace("viridis", quietly = TRUE)) {
+  g <- get("g", envir = envir_stacomi) + ggplot2::theme_minimal()
+  g + viridis::scale_color_viridis(discrete = TRUE) +
+    ggplot2::ggtitle("Cumulated migration step plot
 				at les Enfrenaux eel trap")
-	
-  }
-  ###############################################
+}
+###############################################
 # Plots for seasonality of the salmon migration
 # using a Loire river dataset (Vichy fishway)
-  ################################################
-  data("r_mig_interannual_vichy")
+################################################
+data("r_mig_interannual_vichy")
 # the following show how data are processed to get
 # statistics for seaonal migration, daily values
-  r_mig_interannual_vichy<-calcule(r_mig_interannual_vichy,
-      timesplit="jour",year_choice=2012,silent=TRUE)
-#r_mig_interannual_vichy@calcdata #check this to see the results
+r_mig_interannual_vichy <- calcule(r_mig_interannual_vichy,
+  timesplit = "jour", year_choice = 2012, silent = TRUE
+)
+# r_mig_interannual_vichy@calcdata #check this to see the results
 # statistics for seaonal migration, weekly values
-  r_mig_interannual_vichy<-calcule(r_mig_interannual_vichy,timesplit="semaine"
-                                   ,year_choice=2012,silent=TRUE)
-#r_mig_interannual_vichy@calcdata 
-  
+r_mig_interannual_vichy <- calcule(r_mig_interannual_vichy,
+  timesplit = "semaine",
+  year_choice = 2012, silent = TRUE
+)
+# r_mig_interannual_vichy@calcdata
+
 # the plot method also runs the calcule method
-  plot(r_mig_interannual_vichy,plot.type="seasonal",
-      timesplit="semaine", year_choice=2012, silent=TRUE)
-  plot(r_mig_interannual_vichy,plot.type="seasonal",
-      timesplit="mois", year_choice=2012, silent=TRUE)
-  plot(r_mig_interannual_vichy,plot.type="seasonal",
-      timesplit="jour",year_choice=2012, silent=TRUE)
-  
-  
-  ###############################################
+plot(r_mig_interannual_vichy,
+  plot.type = "seasonal",
+  timesplit = "semaine", year_choice = 2012, silent = TRUE
+)
+plot(r_mig_interannual_vichy,
+  plot.type = "seasonal",
+  timesplit = "mois", year_choice = 2012, silent = TRUE
+)
+plot(r_mig_interannual_vichy,
+  plot.type = "seasonal",
+  timesplit = "jour", year_choice = 2012, silent = TRUE
+)
+
+
+###############################################
 # Plots for seasonality using another Loire river dataset
-# with the migration of Lampreys (Petromyzon marinus) 
+# with the migration of Lampreys (Petromyzon marinus)
 # recorded at the the Descarte DF (Vienne)
-  ################################################
+################################################
 # run this only if you are connected to the logrami dataset
-stacomi(database_expected = TRUE, sch = 'logrami')
-  bmi_des<-new("report_mig_interannual")
-  bmi_des<-choice_c(bmi_des,
-	  dc=c(23),
-	  taxa=c("Petromyzon marinus"),
-	  stage=c("5"),
-	  start_year="2007",
-	  end_year="2014",
-	  silent=TRUE)
-  bmi_des<-connect(bmi_des)	
-  bmi_des<-calcule(bmi_des,timesplit="semaine")
-  plot(bmi_des,plot.type="seasonal",timesplit="semaine",year_choice=2014)
-  plot(bmi_des,plot.type="seasonal",timesplit="jour",year_choice=2014)
-  plot(bmi_des,plot.type="seasonal",timesplit="mois",year_choice=2014)
-}	
-
-
-
+stacomi(database_expected = TRUE, sch = "logrami")
+bmi_des <- new("report_mig_interannual")
+bmi_des <- choice_c(bmi_des,
+  dc = c(23),
+  taxa = c("Petromyzon marinus"),
+  stage = c("5"),
+  start_year = "2007",
+  end_year = "2014",
+  silent = TRUE
+)
+bmi_des <- connect(bmi_des)
+bmi_des <- calcule(bmi_des, timesplit = "semaine")
+plot(bmi_des, plot.type = "seasonal", timesplit = "semaine", year_choice = 2014)
+plot(bmi_des, plot.type = "seasonal", timesplit = "jour", year_choice = 2014)
+plot(bmi_des, plot.type = "seasonal", timesplit = "mois", year_choice = 2014)
+}
 }
 \seealso{
 Other report Objects: 
diff --git a/man/report_mig_mult-class.Rd b/man/report_mig_mult-class.Rd
index 0fbd9da..c9c5e0a 100644
--- a/man/report_mig_mult-class.Rd
+++ b/man/report_mig_mult-class.Rd
@@ -51,7 +51,7 @@ stacomi(database_expected=FALSE)
 ## launches the application in the command line
 ## here an example of loading
 ## the following lines will only run if you have the program installed
-## and the iav scheme available in the database
+## and the test scheme available in the database
 ## this example generates the r_mig_mult dataset
 # prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
@@ -122,6 +122,8 @@ plot(r_mig_mult,plot.type="standard",silent=TRUE)
   
 # Combined plot for ggplot2
   plot(r_mig_mult,plot.type="multiple",silent=TRUE)
+  
+  plot(r_mig_mult,plot.type="time",silent=TRUE)
 # Data will be written in the data directory specified in 
 # the datawd argument to stacomi, default "~"
   summary(r_mig_mult,silent=FALSE)
diff --git a/man/report_sample_char-class.Rd b/man/report_sample_char-class.Rd
index 65f9fba..ba903f9 100644
--- a/man/report_sample_char-class.Rd
+++ b/man/report_sample_char-class.Rd
@@ -42,96 +42,101 @@ of the view vue_lot_ope_car
 stacomi(	database_expected=FALSE)
 # If you have a working database
 # the following line of code will create the r_sample_char 
-# dataset from the iav (default) schema in the database
+# dataset from the test (default) schema in the database
 \dontrun{
-	stacomi(database_expected=TRUE)	# uses default option sch = 'iav'
-	# prompt for user and password, you can set these in the options, 
-	# including dbname and host
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
+  stacomi(database_expected = TRUE)	# uses default option sch = 'test'
+  # prompt for user and password, you can set these in the options,
+  # including dbname and host
+  if (interactive()) {
+    if (!exists("user")) {
+      user <- readline(prompt = "Enter user: ")
+      password <- readline(prompt = "Enter password: ")
+    }
+  }
+  options(
+    stacomiR.dbname = "bd_contmig_nat",
+    stacomiR.host = "localhost",
+    stacomiR.port = "5432",
+    stacomiR.user = user,
+    stacomiR.user = password
+  )
   #create an instance of the class
   r_sample_char <- new("report_sample_char")
-  # the following will load data for size, 
+  # the following will load data for size,
   # parameters 1786 (total size) C001 (size at video control)
   # dc 5 and 6 are fishways located on the Arzal dam
   # two stages are selected
-  r_sample_char <- choice_c(r_sample_char,
-	  dc=c(5,6),
-	  taxa=c("Anguilla anguilla"),
-	  stage=c("AGJ","CIV"),
-	  par=c(1785,1786,1787,"C001"),
-	  horodatedebut="2013-01-01",
-	  horodatefin="2013-12-31",
-	  silent=FALSE)
+  r_sample_char <- choice_c(
+    r_sample_char,
+    dc = c(5, 6),
+    taxa = c("Anguilla anguilla"),
+    stage = c("AGJ", "CIV"),
+    par = c(1786, "C001"),
+    horodatedebut = "2013-01-01",
+    horodatefin = "2013-12-31",
+    silent = FALSE
+  )
   # two warning produced, ignored if silent=TRUE
   r_sample_char <- connect(r_sample_char)
-  r_sample_char <- calcule(r_sample_char,silent=TRUE)
+  r_sample_char <- calcule(r_sample_char, silent = TRUE)
   
-}	
+}
 # load the dataset generated by previous lines
 data("r_sample_char")
 
 # A "violin" plot
-plot(r_sample_char,plot.type="1",silent=TRUE)
+plot(r_sample_char, plot.type = "1", silent = TRUE)
 # get the plot from envir_stacomi to change labels for name
 # if you use require(ggplot2) the :: argument is not needed
 # e.g. write require(ggplot2);g<-get("g",envir=envir_stacomi)
 # g+xlab("size")+ylab("year")
-if (requireNamespace("ggplot2", quietly = TRUE)){
-  g<-get("g",envir=envir_stacomi)
-  g+ggplot2::xlab("size")+ggplot2::ylab("year")
+if (requireNamespace("ggplot2", quietly = TRUE)) {
+  g1 <- get("g1", envir = envir_stacomi)
+  g1 + ggplot2::xlab("size") + ggplot2::ylab("year")
 }
-# A boxplot per month
-plot(r_sample_char,plot.type="2",silent=TRUE)
-# A xyplot
-plot(r_sample_char,plot.type="3",silent=TRUE)
+# A boxplot per month (named g2 in envir_stacomi)
+plot(r_sample_char, plot.type = "2", silent = TRUE)
+# A xyplot (named g3 in envir_stacomi)
+plot(r_sample_char, plot.type = "3", silent = TRUE)
 
 \dontrun{
   
   #####################################
-# an example graph created manually from data
+  # an example graph created manually from data
   #####################################
-# two variables one on DC, one on stage
-# passing dc information to the stage variable
-  r_sample_char@data$std_libelle[r_sample_char@data$ope_dic_identifiant==5]<-
-      "Yellow eel (vert. slot fishway)"
-  r_sample_char@data$std_libelle[r_sample_char@data$std_libelle=="Anguille jaune"]<-
-      "Yellow eel (ramp)"
-  r_sample_char@data$std_libelle[r_sample_char@data$std_libelle=="civelle"]<-
-      "Glass eel (ramp)"
-# creating a boxplot with custom output : an example
-# again if you use require(ggplot2) the :: argument is not needed
+  # two variables one on DC, one on stage
+  # passing dc information to the stage variable
+  r_sample_char@data$std_libelle[r_sample_char@data$ope_dic_identifiant ==
+                                   5] <-
+    "Yellow eel (vert. slot fishway)"
+  r_sample_char@data$std_libelle[r_sample_char@data$std_libelle == "Anguille jaune"] <-
+    "Yellow eel (ramp)"
+  r_sample_char@data$std_libelle[r_sample_char@data$std_libelle == "civelle"] <-
+    "Glass eel (ramp)"
+  # creating a boxplot with custom output : an example
+  # again if you use require(ggplot2) the :: argument is not needed
   
-  if (requireNamespace("ggplot2", quietly = TRUE)){
-	g<-ggplot2::ggplot(r_sample_char@data)+
-		ggplot2::geom_boxplot(ggplot2::aes(x=annee,
-				y =car_valeur_quantitatif,
-				fill = std_libelle))+		
-		ggplot2::xlab("size")+ggplot2::ylab("year")+
-		ggplot2::scale_fill_manual("stage & fishway",
-			values=c("Yellow eel (vert. slot fishway)"="blue",
-				"Yellow eel (ramp)"="turquoise3",
-				"Glass eel (ramp)"="Cyan"))+
-		ggplot2::theme_bw()
-	print(g)
+  if (requireNamespace("ggplot2", quietly = TRUE)) {
+    g <- ggplot2::ggplot(r_sample_char@data) +
+      ggplot2::geom_boxplot(ggplot2::aes(x = annee, y = car_valeur_quantitatif, fill = std_libelle)) +
+      ggplot2::xlab("size") + ggplot2::ylab("year") +
+      ggplot2::scale_fill_manual(
+        "stage & fishway",
+        values = c(
+          "Yellow eel (vert. slot fishway)" = "blue",
+          "Yellow eel (ramp)" = "turquoise3",
+          "Glass eel (ramp)" = "Cyan"
+        )
+      ) +
+      ggplot2::theme_bw()
+    print(g)
   }
   
-# get a simple summary using Hmisc::describe
+  # get a simple summary using Hmisc::describe
   
   summary(r_sample_char)
-# get the command line to create the object using choice_c 
-# when the graphical interface has been used
+  # get the command line to create the object using choice_c
+  # when the graphical interface has been used
   print(r_sample_char)
 }
 }
diff --git a/man/report_sea_age-class.Rd b/man/report_sea_age-class.Rd
index f73b724..6e809b1 100644
--- a/man/report_sea_age-class.Rd
+++ b/man/report_sea_age-class.Rd
@@ -48,63 +48,65 @@ This class is displayed by interface_report_sea_age
 
 \examples{
 require(stacomiR)
-stacomi(
-	database_expected=FALSE)
+stacomi(database_expected = FALSE)
 # If you have a working database
-# the following line of code will create the r_seaa dataset 
+# the following line of code will create the r_seaa dataset
 # from the logrami schema in the database
 \dontrun{
-		stacomi(database_expected=TRUE, sch='logrami')	
-		# overrides the default option sch = 'iav'
-		# prompt for user and password, you can set these in the options,
-	  # including dbname and host
-		if (interactive()){
-			if (!exists("user")){
-				user <- readline(prompt="Enter user: ")
-				password <- readline(prompt="Enter password: ")	
-			}	
-		}
-		options(					
-				stacomiR.dbname = "bd_contmig_nat",
-				stacomiR.host ="localhost",
-				stacomiR.port = "5432",
-				stacomiR.user = user,
-				stacomiR.user = password						
-		)	
+  stacomi(database_expected = TRUE, sch = 'test')
+  # prompt for user and password, you can set these in the options,
+  # including dbname and host
+  if (interactive()) {
+    if (!exists("user")) {
+      user <- readline(prompt = "Enter user: ")
+      password <- readline(prompt = "Enter password: ")
+    }
+  }
+  options(
+    stacomiR.dbname = "bd_contmig_nat",
+    stacomiR.host = "localhost",
+    stacomiR.port = "5432",
+    stacomiR.user = user,
+    stacomiR.user = password
+  )
   #create an instance of the class
-  r_seaa<-new("report_sea_age")
-  r_seaa<-choice_c(r_seaa,
-	  dc=c(107,108,101),			
-	  horodatedebut="2012-01-01",
-	  horodatefin="2012-12-31",
-	  limit1hm=675,
-	  limit2hm=875,
-	  silent=FALSE
+  r_seaa <- new("report_sea_age")
+  r_seaa <- choice_c(
+    r_seaa,
+    dc = c(19, 20),
+    horodatedebut = "2012-01-01",
+    horodatefin = "2012-12-31",
+    stage = c('5'),
+    par = c('C001', 'A124'),
+    limit1hm = 675,
+    limit2hm = 875,
+    silent = FALSE
   )
-  r_seaa<-connect(r_seaa)
-  r_seaa<-calcule(r_seaa)
+  r_seaa <- connect(r_seaa)
+  r_seaa <- calcule(r_seaa)
   
-}	
+}
 # load the dataset generated by previous lines
 # Salmons from the loire on two dams
 data("r_seaa")
 # the calculation will fill the slot calcdata
 
-# stages are in r_seaa@calcdata[["6"]][,"stage"] 
+# stages are in r_seaa@calcdata[["6"]][,"stage"]
 #look at data structure using str(r_seaa@calcdata[["6"]])
 
 # plot data to confirm the split by limits is correct
-plot(r_seaa, plot.type=1)
+plot(r_seaa, plot.type = 1)
 
 # if there are several dc, data it split by dc
-plot(r_seaa, plot.type=2)
+plot(r_seaa, plot.type = 2)
 \dontrun{
-# print a summary statistic, and save the output in a list for later use
-  stats<-summary(r_seaa)
+  # print a summary statistic, and save the output in a list for later use
+  stats <- summary(r_seaa)
   
   
   write_database(r_seaa)
 }
+
 }
 \seealso{
 Other report Objects: 
diff --git a/man/report_silver_eel-class.Rd b/man/report_silver_eel-class.Rd
index b09fe4f..1b5a164 100644
--- a/man/report_silver_eel-class.Rd
+++ b/man/report_silver_eel-class.Rd
@@ -48,64 +48,66 @@ This class is displayed by interface_report_silver_eel
 
 \examples{
 # launching stacomi without selecting the scheme or interface
-stacomi(	database_expected=FALSE)
+stacomi(database_expected = FALSE)
 # the following script will load data from the two Anguillere monitored in the Somme
 
 # If you have a working database
-# the following line of code will create the r_silver dataset 
+# the following line of code will create the r_silver dataset
 # from the "fd80." schema in the database
 \dontrun{
-	stacomi(database_expected=TRUE, sch="fd80.")	# overrides the default option sch = 'iav'
-	# prompt for user and password, you can set these in the options, 
-	# including dbname and host
-	if (interactive()){
-		if (!exists("user")){
-			user <- readline(prompt="Enter user: ")
-			password <- readline(prompt="Enter password: ")	
-		}	
-	}
-	options(					
-			stacomiR.dbname = "bd_contmig_nat",
-			stacomiR.host ="localhost",
-			stacomiR.port = "5432",
-			stacomiR.user = user,
-			stacomiR.user = password						
-	)	
-	
+  stacomi(database_expected = TRUE, sch = "fd80.")	# overrides the default option sch = 'iav'
+  # prompt for user and password, you can set these in the options,
+  # including dbname and host
+  if (interactive()) {
+    if (!exists("user")) {
+      user <- readline(prompt = "Enter user: ")
+      password <- readline(prompt = "Enter password: ")
+    }
+  }
+  options(
+    stacomiR.dbname = "bd_contmig_nat",
+    stacomiR.host = "localhost",
+    stacomiR.port = "5432",
+    stacomiR.user = user,
+    stacomiR.user = password
+  )
+  
   #create an instance of the class
-  r_silver<-new("report_silver_eel")
-  r_silver<-choice_c(r_silver,
-	  dc=c(2,6),			
-	  horodatedebut="2010-09-01",
-	  horodatefin="2016-10-04",
-	  silent=FALSE)
-  r_silver<-connect(r_silver)	
-}	
+  r_silver <- new("report_silver_eel")
+  r_silver <- choice_c(
+    r_silver,
+    dc = c(2, 6),
+    horodatedebut = "2010-09-01",
+    horodatefin = "2016-10-04",
+    silent = FALSE
+  )
+  r_silver <- connect(r_silver)
+}
 # load the dataset generated by previous lines
 data("r_silver")
 # the calculation will fill the slot calcdata
-r_silver<-calcule(r_silver)
-# stages are in r_silver@calcdata[["6"]][,"stage"] 
+r_silver <- calcule(r_silver)
+# stages are in r_silver@calcdata[["6"]][,"stage"]
 #look at data structure using str(r_silver@calcdata[["6"]])
 
 # standard plot as drawn by Laurent Beaulaton (Analyse des donnees d'argenture acquises en France)
 # showing Durif's stage according to size and eye diameter
-plot(r_silver, plot.type=1)
+plot(r_silver, plot.type = 1)
 
 # number per month or year and Durif's stage (year if number of dc >1)
-plot(r_silver, plot.type="2")
+plot(r_silver, plot.type = "2")
 
 # plot showing fulton's coefficient, and size weight graphs
-# inspired from Acou et al., 2009 
+# inspired from Acou et al., 2009
 # Differential Production and Condition Indices of Premigrant
 # Eels in Two Small Atlantic Coastal Catchments
 # of France
-plot(r_silver, plot.type="3")
+plot(r_silver, plot.type = "3")
 # get a list of summary data and print output to screen
 
-plot(r_silver, plot.type="4")
+plot(r_silver, plot.type = "4")
 # print a summary statistic, and save the output in a list for later use
-stats<-summary(r_silver)
+stats <- summary(r_silver)
 }
 \seealso{
 Other report Objects: 
diff --git a/man/report_species-class.Rd b/man/report_species-class.Rd
index a396d61..d25295e 100644
--- a/man/report_species-class.Rd
+++ b/man/report_species-class.Rd
@@ -36,53 +36,60 @@ year/week/month.
 
 \examples{
 # launching stacomi without selecting the scheme or interface
-stacomi(	database_expected=FALSE)
-# the following script will load data 
+stacomi(database_expected = FALSE)
+# the following script will load data
 # from the two Anguillere monitored in the Somme
 # If you have a working database
-# the following line of code will create the bilesp dataset from the "iav." 
+# the following line of code will create the bilesp dataset from the "test." 
 # schema in the database
 
 \dontrun{
-  bilesp<-new("report_species")
+  bilesp <- new("report_species")
   # split is one of "none", "year", "week", "month
-  bilesp<-choice_c(bilesp,
-	  dc=c(5,6,12),
-	  split="year", 
-	  start_year="2008",
-	  end_year="2012",
-	  silent=FALSE)	
+  bilesp <- choice_c(
+    bilesp,
+    dc = c(5, 6, 12),
+    split = "year",
+    start_year = "2009",
+    end_year = "2012",
+    silent = FALSE
+  )
   bilesp <- connect(bilesp)
   bilesp <- calcule(bilesp)
-  plot(bilesp, plot.type="pie", silent=FALSE)
-  plot(bilesp, plot.type="barplot", silent=FALSE)
-  bilesp <- choice_c(bilesp,
-	  dc=c(5,6,12),
-	  split="month",
-	  start_year="2015",
-	  end_year="2016",
-	  silent=FALSE)
+  plot(bilesp, plot.type = "pie", silent = FALSE)
+  plot(bilesp, plot.type = "barplot", silent = FALSE)
+  bilesp <- choice_c(
+    bilesp,
+    dc = c(5, 6, 12),
+    split = "month",
+    start_year = "2009",
+    end_year = "2012",
+    silent = FALSE
+  )
   bilesp <- charge(bilesp)
   bilesp <- connect(bilesp)
-  plot(bilesp, plot.type="pie", silent=FALSE)
-  plot(bilesp, plot.type="barplot", silent=FALSE)
+  bilesp <- calcule(bilesp)
+  plot(bilesp, plot.type = "pie", silent = FALSE)
+  plot(bilesp, plot.type = "barplot", silent = FALSE)
   #length(unique(bilesp@calcdata$taxa_stage)) # 15
   # here creating a vector of length 15 with nice blending colours
-	if (requireNamespace("grDevices", quietly = TRUE)) {
-	mycolorrampblue <-
-			grDevices::colorRampPalette(c("#395B74", "#010F19"))
-	mycolorrampyellow <-
-			grDevices::colorRampPalette(c("#B59C53", "#271D00"))
-	mycolorrampred <-
-			grDevices::colorRampPalette(c("#B56F53", "#270B00"))
-  color<-c(mycolorrampblue(5),
-	  mycolorrampyellow(5),
-	  mycolorrampred(5))
-  plot(bilesp,plot.type="barplot",color=color,silent=TRUE)
-	}
+  if (requireNamespace("grDevices", quietly = TRUE)) {
+    mycolorrampblue <-
+      grDevices::colorRampPalette(c("#395B74", "#010F19"))
+    mycolorrampyellow <-
+      grDevices::colorRampPalette(c("#B59C53", "#271D00"))
+    mycolorrampred <-
+      grDevices::colorRampPalette(c("#B56F53", "#270B00"))
+    color <- c(mycolorrampblue(3),
+               mycolorrampyellow(3),
+               mycolorrampred(4))
+    plot(bilesp,
+         plot.type = "barplot",
+         color = color,
+         silent = TRUE)
+  }
   summary(bilesp)
-}	
-
+}
 }
 \seealso{
 Other report Objects: 
diff --git a/man/stacomi.Rd b/man/stacomi.Rd
index 8da2106..eb13dc5 100644
--- a/man/stacomi.Rd
+++ b/man/stacomi.Rd
@@ -22,23 +22,23 @@ To change the language use Sys.setenv(LANG = 'fr') or Sys.setenv(LANG = 'en')
 }
 \examples{
 
- require(stacomiR)
-#launch stacomi 
- \dontrun{ 
-stacomi(database_expected=TRUE, datawd='~',sch= "iav")
+require(stacomiR)
+# launch stacomi
+\dontrun{
+stacomi(database_expected = TRUE, datawd = tempdir(), sch = "iav")
 }
 # launch stacomi without connection to the database
-stacomi(database_expected=FALSE)
+stacomi(database_expected = FALSE)
 # launch stacomi with options
 options(
-	stacomiR.dbname = "bd_contmig_nat",
-	stacomiR.host = readline(prompt = "Enter host: "),
-	stacomiR.port = "5432",
-	stacomiR.user = readline(prompt = "Enter user: "),
-	stacomiR.password = readline(prompt = "Enter password: ")
+  stacomiR.dbname = "bd_contmig_nat",
+  stacomiR.host = readline(prompt = "Enter host: "),
+  stacomiR.port = "5432",
+  stacomiR.user = readline(prompt = "Enter user: "),
+  stacomiR.password = readline(prompt = "Enter password: ")
 )
 # another usefull option to print all queries run by stacomiR to the console
- options('stacomiR.printqueries'= TRUE)
+options("stacomiR.printqueries" = TRUE)
 }
 \author{
 Cedric Briand \email{cedric.briand@eptb-vilaine.fr}
-- 
GitLab


From 4cf6c2686450851f8c414b5cff5ee58f7c970307 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Sat, 1 Mar 2025 19:54:32 +0100
Subject: [PATCH 09/13] up

---
 dev/03_deploy.R                 |   2 +-
 gitlab-ci/codecov.gitlab-ci.yml |  11 +++-
 gitlab-ci/helper.R              |  16 +++++
 tests/testthat/helper.R         |   2 +
 vignettes/stacomir.R            | 105 --------------------------------
 5 files changed, 27 insertions(+), 109 deletions(-)
 create mode 100644 gitlab-ci/helper.R
 delete mode 100644 vignettes/stacomir.R

diff --git a/dev/03_deploy.R b/dev/03_deploy.R
index 6346d20..4d83762 100644
--- a/dev/03_deploy.R
+++ b/dev/03_deploy.R
@@ -21,7 +21,7 @@ Sys.setenv("LANGUAGE" = "en") # otherwise problems when running from Rstudio
 options(
   stacomiR.dbname = "bd_contmig_nat",
   stacomiR.host = "localhost",
-  stacomiR.port = "5432",
+  stacomiR.port = "5435",
   stacomiR.user = "stacomi_test",
   stacomiR.password = "stacomi_test"
 )
diff --git a/gitlab-ci/codecov.gitlab-ci.yml b/gitlab-ci/codecov.gitlab-ci.yml
index a4eb6cd..2a07ea9 100644
--- a/gitlab-ci/codecov.gitlab-ci.yml
+++ b/gitlab-ci/codecov.gitlab-ci.yml
@@ -6,12 +6,17 @@
     - Rscript -e 'pak::pkg_install(pkg = c("covr", "DT"), upgrade = FALSE)'
     - Rscript -e 'pak::pak(pkg = ".", upgrade = FALSE)'
     - |
-      Rscript -e 'Sys.setenv("NOT_CRAN"= "true"); devtools::load_all(); 
-      options(stacomiR.dbname = "'${PG_DB}'",
+      Rscript -e 'Sys.setenv("NOT_CRAN"= "true"); devtools::load_all();
+      txt_option <- "options(stacomiR.dbname = "'${PG_DB}'",
       stacomiR.host = "'${PG_HOST}'",
       stacomiR.port = "'${PG_PORT}'",
       stacomiR.user = "'${PG_USER}'",
-      stacomiR.password ="'${PG_USER_PASSWORD}'");
+      stacomiR.password ="'${PG_USER_PASSWORD}'")";
+      source("gitlab-ci/helper.R");
+      copier_option(
+        file_path = "tests/testthat/helper.R",
+        new_text = txt_option
+      )
       covr::gitlab(quiet = FALSE)'
   coverage: '/Coverage: \d+\.\d+/' 
   artifacts:
diff --git a/gitlab-ci/helper.R b/gitlab-ci/helper.R
new file mode 100644
index 0000000..5d24a74
--- /dev/null
+++ b/gitlab-ci/helper.R
@@ -0,0 +1,16 @@
+copier_option <- function(
+  file_path = "chemin/vers/votre/fichier.txt",
+  old_text = "# options here for codecov",
+  new_text = "mon code"
+) {
+  # Lire le contenu du fichier
+  file_content <- readLines(file_path, encoding = "UTF-8")
+
+  # Remplacer le texte
+  new_content <- gsub(old_text, new_text, file_content)
+
+  # Écrire le nouveau contenu dans le fichier
+  writeLines(new_content, file_path)
+
+  cat("Remplacement effectué avec succès dans le fichier :", file_path, "\n")
+}
diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R
index 1863ef2..b07e1eb 100644
--- a/tests/testthat/helper.R
+++ b/tests/testthat/helper.R
@@ -4,6 +4,8 @@
 # https://testthat.r-lib.org/articles/test-fixtures.html#withr-defer-
 # could have used with_envvar and local_envvar but had to set them each time
 
+# options here for codecov
+
 password <- getOption("stacomiR.password") # if not set will be ""
 dbname <- getOption("stacomiR.dbname") # if not set will be ""
 user <- getOption("stacomiR.user")
diff --git a/vignettes/stacomir.R b/vignettes/stacomir.R
deleted file mode 100644
index 5a35e17..0000000
--- a/vignettes/stacomir.R
+++ /dev/null
@@ -1,105 +0,0 @@
-## ----setup, include = FALSE---------------------------------------------------
-require(knitr)
-knitr::opts_chunk$set(
-		collapse = TRUE,
-		comment = "#>",
-		fig.path = "../man/figures/README-"
-)
-opts_knit$set(message=FALSE, warnings=FALSE,error=FALSE,include=FALSE) 
-
-## ----echo=FALSE, include=FALSE------------------------------------------------
-library(stacomiR)
-
-
-## ---- eval=FALSE--------------------------------------------------------------
-#  # get the package from CRAN
-#  install.packages("stacomiR")
-#  # get the development version
-#  install.packages("stacomiR", repos="http://R-Forge.R-project.org")
-
-## ---- eval=FALSE--------------------------------------------------------------
-#  stacomi()
-
-## ---- eval=FALSE--------------------------------------------------------------
-#  #here is an example to connect with interactive use
-#  options(
-#  		stacomiR.dbname = "bd_contmig_nat",
-#  		stacomiR.host = readline(prompt = "Enter host: "),
-#  		stacomiR.port = "5432",
-#  		stacomiR.user = readline(prompt = "Enter user: "),
-#  		stacomiR.password = readline(prompt = "Enter password: ")
-#  )
-#  # the schema of connection is passed by sch
-#  stacomi(database_expected = TRUE, sch= "iav")
-
-## ---- eval=TRUE, echo=TRUE----------------------------------------------------
-## launches the application in the command line without connection to the database
-stacomi(database_expected=FALSE) 
-
-## ----eval=FALSE,echo=TRUE-----------------------------------------------------
-#  require(stacomiR)
-#  stacomi(
-#  		database_expected=TRUE)	
-#  r_mig_mult=new("report_mig_mult")
-#  r_mig_mult=choice_c(r_mig_mult,
-#  		dc=c(5,6,12),
-#  		taxa=c("Anguilla anguilla"),
-#  		stage=c("AGG","AGJ","CIV"),
-#  		datedebut="2011-01-01",
-#  		datefin="2011-12-31")
-#  r_mig_mult<-charge(r_mig_mult)
-#  # launching charge will also load classes associated with the report
-#  # e.g. report_ope, report_df, report_dc
-#  r_mig_mult<-connect(r_mig_mult)
-#  # calculations
-#  r_mig_mult<-calcule(r_mig_mult,silent=TRUE)
-
-## ----rmmstd,eval=FALSE,echo=TRUE,message=FALSE,fig.height=6,fig.with=8--------
-#  # Without a connection at the database we can launch these lines to generate the graph
-#  # To obtain titles in french use Sys.setenv(LANG = "fr")
-#  # the
-#  require(stacomiR)
-#  stacomi(
-#  		database_expected=FALSE)	
-#  data("r_mig_mult")
-#  data("r_mig_mult_ope")
-#  assign("report_ope",r_mig_mult_ope,envir=envir_stacomi)
-#  data("r_mig_mult_df")
-#  assign("report_df",r_mig_mult_df,envir=envir_stacomi)
-#  data("r_mig_mult_dc")
-#  assign("report_dc",r_mig_mult_dc,envir=envir_stacomi)
-#  # The two lines below avoid an error in MacOSX, the r_mig_mult currently has CET
-#  # which for some reason provides a failure when testing the vignette in MaxOSX (twice the same date in seq.POSIXt)
-#  attr(r_mig_mult@data$ope_date_debut, "tzone") <- "UTC"
-#  attr(r_mig_mult@data$ope_date_fin, "tzone") <- "UTC"
-#  r_mig_mult <- calcule(r_mig_mult,silent=TRUE)
-#  
-#  
-#  # restrict to glass eel
-#  r_mig_mult@stage@stage_selected <- r_mig_mult@stage@stage_selected[3]
-#  r_mig_mult@dc@dc_selected <- r_mig_mult@dc@dc_selected[3]
-#  r_mig_mult <- calcule(r_mig_mult,silent=TRUE)
-#  plot(r_mig_mult, plot.type="standard", silent=TRUE)
-
-## ----rmmmult,eval=TRUE,echo=TRUE,fig.height = 4, fig.width = 6----------------
-
-plot(r_mig_mult,plot.type="multiple",silent=TRUE)
-
-## ----silver,eval=TRUE,echo=TRUE,message=FALSE,warning=FALSE,fig.height = 4, fig.width = 6,fig.keep="all"----
-require(stacomiR)
-data("coef_durif")
-# load a dataset of class report_silver_eel with data slot already prepared
-# here is an example of output 
-data("r_silver")
-r_silver <- calcule(r_silver)
-plot(r_silver, plot.type="3")
-#######################################
-# To use the function fun_stage_durif manually
-# create a matrix with columns BL","W","Dv","Dh","FL"
-#############################################
-# here it is extracted from the data at hand
-silver_eel<-as.matrix(r_silver@calcdata[[1]][,c("BL","W","Dv","Dh","FL")])
-head(silver_eel) # to see the first lines
-stage <- fun_stage_durif(silver_eel) # apply the function to the matrix
-stage[1:10] # look at the first 10 elements in vector silver
-
-- 
GitLab


From 9e075bc8f61625633980945eaaa8f3accd15b942 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Sun, 2 Mar 2025 10:59:41 +0100
Subject: [PATCH 10/13] up

---
 gitlab-ci/codecov.gitlab-ci.yml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gitlab-ci/codecov.gitlab-ci.yml b/gitlab-ci/codecov.gitlab-ci.yml
index 2a07ea9..d15981d 100644
--- a/gitlab-ci/codecov.gitlab-ci.yml
+++ b/gitlab-ci/codecov.gitlab-ci.yml
@@ -8,10 +8,11 @@
     - |
       Rscript -e 'Sys.setenv("NOT_CRAN"= "true"); devtools::load_all();
       txt_option <- "options(stacomiR.dbname = "'${PG_DB}'",
-      stacomiR.host = "'${PG_HOST}'",
-      stacomiR.port = "'${PG_PORT}'",
-      stacomiR.user = "'${PG_USER}'",
-      stacomiR.password ="'${PG_USER_PASSWORD}'")";
+      txt_option <- paste0("options(stacomiR.dbname = '", ${PG_DB},"',
+        stacomiR.host = '", ${PG_HOST},"', 
+        stacomiR.port = '", ${PG_PORT},"', 
+        stacomiR.user = '", ${PG_USER},"', 
+        stacomiR.password = '", ${PG_USER_PASSWORD}, "')");
       source("gitlab-ci/helper.R");
       copier_option(
         file_path = "tests/testthat/helper.R",
-- 
GitLab


From 339d4e82615ff5d030edd24a5438e3616be36cdf Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Sun, 2 Mar 2025 11:44:28 +0100
Subject: [PATCH 11/13] up

---
 R/stacomi.R                                    |  2 +-
 README.md                                      | 16 ++++++++++------
 dev/03_deploy.R                                |  2 +-
 gitlab-ci/check.gitlab-ci.yml                  |  7 ++++++-
 gitlab-ci/codecov.gitlab-ci.yml                |  1 -
 inst/examples/report_mig_interannual-example.R | 16 ++++++++++++++--
 inst/examples/report_sample_char-example.R     |  4 +++-
 man/report_mig_interannual-class.Rd            | 16 ++++++++++++++--
 man/report_sample_char-class.Rd                |  4 +++-
 man/stacomi.Rd                                 |  2 +-
 10 files changed, 53 insertions(+), 17 deletions(-)

diff --git a/R/stacomi.R b/R/stacomi.R
index 3e3bc51..a7c3bbb 100644
--- a/R/stacomi.R
+++ b/R/stacomi.R
@@ -103,7 +103,7 @@ load_stacomi <- function(...) {
 #' @param datawd The data working directory
 #' @param sch The schema in the stacomi database default 'test'.
 #' @return Nothing, called for its side effect of loading
-#' @usage stacomi(database_expected=TRUE, datawd = "~", sch = "test")
+#' @usage stacomi(database_expected=TRUE, datawd = tempdir(), sch = "test")
 #' @author Cedric Briand \email{cedric.briand@eptb-vilaine.fr}
 #' @examples
 #'
diff --git a/README.md b/README.md
index 98ecdf5..4a0d8eb 100644
--- a/README.md
+++ b/README.md
@@ -54,10 +54,10 @@ database.
 
 ``` r
 library(stacomiR)
-#> Le chargement a nécessité le package : stacomirtools
-#> Le chargement a nécessité le package : RODBC
-#> Le chargement a nécessité le package : DBI
-#> Le chargement a nécessité le package : pool
+#> Loading required package: stacomirtools
+#> Loading required package: RODBC
+#> Loading required package: DBI
+#> Loading required package: pool
 stacomi(database_expected = FALSE)
 ```
 
@@ -77,8 +77,8 @@ options(
     stacomiR.dbname = "bd_contmig_nat",
     stacomiR.host ="localhost",         
     stacomiR.port ="5432",  
-    stacomiR.user = "postgres",     
-    stacomiR.password = "postgres"                      
+    stacomiR.user = "stacomi_test",     
+    stacomiR.password = "stacomi_test"                      
 )   
 stacomi(database_expected = TRUE) 
 # set up a basic report for eel two stages (yellow and silver) annual number in pass 5, 6, 12 (fishway, left bank eel pass, right bank eel pass)
@@ -92,6 +92,10 @@ r_ann <- choice_c(
                     start_year ="1996",
                     end_year = "2015",
                     silent = TRUE) 
+#> Warning in .local(object, ...): Attention, year 1996 is not available in the
+#> database, available years : none
+#> Warning in .local(object, ...): Attention, year 2015 is not available in the
+#> database, available years : none
 r_ann <- connect(r_ann, silent = TRUE) 
 options(o)
 ```
diff --git a/dev/03_deploy.R b/dev/03_deploy.R
index 4d83762..6346d20 100644
--- a/dev/03_deploy.R
+++ b/dev/03_deploy.R
@@ -21,7 +21,7 @@ Sys.setenv("LANGUAGE" = "en") # otherwise problems when running from Rstudio
 options(
   stacomiR.dbname = "bd_contmig_nat",
   stacomiR.host = "localhost",
-  stacomiR.port = "5435",
+  stacomiR.port = "5432",
   stacomiR.user = "stacomi_test",
   stacomiR.password = "stacomi_test"
 )
diff --git a/gitlab-ci/check.gitlab-ci.yml b/gitlab-ci/check.gitlab-ci.yml
index 3714e3e..289d50d 100644
--- a/gitlab-ci/check.gitlab-ci.yml
+++ b/gitlab-ci/check.gitlab-ci.yml
@@ -6,7 +6,12 @@
   stage: check
   script:
     - mkdir -p public/check
-    - r -e 'devtools::load_all();devtools::check(document = FALSE, args = "--no-tests", check_dir="public/check")'
+    - |
+      r -e '
+        Sys.setenv('_R_CHECK_SYSTEM_CLOCK_' = 0);
+        devtools::load_all();
+        devtools::check(document = FALSE, args = "--no-tests", check_dir="public/check")
+      '
   artifacts:
     when: always  
     paths:
diff --git a/gitlab-ci/codecov.gitlab-ci.yml b/gitlab-ci/codecov.gitlab-ci.yml
index d15981d..cebbd5f 100644
--- a/gitlab-ci/codecov.gitlab-ci.yml
+++ b/gitlab-ci/codecov.gitlab-ci.yml
@@ -7,7 +7,6 @@
     - Rscript -e 'pak::pak(pkg = ".", upgrade = FALSE)'
     - |
       Rscript -e 'Sys.setenv("NOT_CRAN"= "true"); devtools::load_all();
-      txt_option <- "options(stacomiR.dbname = "'${PG_DB}'",
       txt_option <- paste0("options(stacomiR.dbname = '", ${PG_DB},"',
         stacomiR.host = '", ${PG_HOST},"', 
         stacomiR.port = '", ${PG_PORT},"', 
diff --git a/inst/examples/report_mig_interannual-example.R b/inst/examples/report_mig_interannual-example.R
index 7e0e1b2..2a4181b 100644
--- a/inst/examples/report_mig_interannual-example.R
+++ b/inst/examples/report_mig_interannual-example.R
@@ -121,10 +121,22 @@ if (requireNamespace("ggplot2", quietly = TRUE) &
 # with the silent=TRUE argument, it's always the latest year that is selected,
 # otherwise the user is prompted with a choice, to select the year he wants
 # to compare will all others...
-plot(r_mig_interannual, plot.type = "barchart", timesplit = "quinzaine", year_choice = 2015, silent = TRUE)
+plot(
+  r_mig_interannual,
+  plot.type = "barchart",
+  timesplit = "quinzaine",
+  year_choice = 2015,
+  silent = TRUE
+)
 # Comparison with historical values. Each year and 2 weeks values
 # is a point on the graph...
-plot(r_mig_interannual, plot.type = "pointrange", timesplit = "mois", year_choice = 2015, silent = TRUE)
+plot(
+  r_mig_interannual,
+  plot.type = "pointrange",
+  timesplit = "mois",
+  year_choice = 2015,
+  silent = TRUE
+)
 ###############################################
 # Step plot
 # different years shown in the graph
diff --git a/inst/examples/report_sample_char-example.R b/inst/examples/report_sample_char-example.R
index 07a35f8..e73a437 100644
--- a/inst/examples/report_sample_char-example.R
+++ b/inst/examples/report_sample_char-example.R
@@ -78,7 +78,9 @@ plot(r_sample_char, plot.type = "3", silent = TRUE)
   
   if (requireNamespace("ggplot2", quietly = TRUE)) {
     g <- ggplot2::ggplot(r_sample_char@data) +
-      ggplot2::geom_boxplot(ggplot2::aes(x = annee, y = car_valeur_quantitatif, fill = std_libelle)) +
+      ggplot2::geom_boxplot(
+        ggplot2::aes(x = annee, y = car_valeur_quantitatif, fill = std_libelle)
+      ) +
       ggplot2::xlab("size") + ggplot2::ylab("year") +
       ggplot2::scale_fill_manual(
         "stage & fishway",
diff --git a/man/report_mig_interannual-class.Rd b/man/report_mig_interannual-class.Rd
index 19f47d3..ae967b9 100644
--- a/man/report_mig_interannual-class.Rd
+++ b/man/report_mig_interannual-class.Rd
@@ -160,10 +160,22 @@ if (requireNamespace("ggplot2", quietly = TRUE) &
 # with the silent=TRUE argument, it's always the latest year that is selected,
 # otherwise the user is prompted with a choice, to select the year he wants
 # to compare will all others...
-plot(r_mig_interannual, plot.type = "barchart", timesplit = "quinzaine", year_choice = 2015, silent = TRUE)
+plot(
+  r_mig_interannual,
+  plot.type = "barchart",
+  timesplit = "quinzaine",
+  year_choice = 2015,
+  silent = TRUE
+)
 # Comparison with historical values. Each year and 2 weeks values
 # is a point on the graph...
-plot(r_mig_interannual, plot.type = "pointrange", timesplit = "mois", year_choice = 2015, silent = TRUE)
+plot(
+  r_mig_interannual,
+  plot.type = "pointrange",
+  timesplit = "mois",
+  year_choice = 2015,
+  silent = TRUE
+)
 ###############################################
 # Step plot
 # different years shown in the graph
diff --git a/man/report_sample_char-class.Rd b/man/report_sample_char-class.Rd
index ba903f9..08acf26 100644
--- a/man/report_sample_char-class.Rd
+++ b/man/report_sample_char-class.Rd
@@ -118,7 +118,9 @@ plot(r_sample_char, plot.type = "3", silent = TRUE)
   
   if (requireNamespace("ggplot2", quietly = TRUE)) {
     g <- ggplot2::ggplot(r_sample_char@data) +
-      ggplot2::geom_boxplot(ggplot2::aes(x = annee, y = car_valeur_quantitatif, fill = std_libelle)) +
+      ggplot2::geom_boxplot(
+        ggplot2::aes(x = annee, y = car_valeur_quantitatif, fill = std_libelle)
+      ) +
       ggplot2::xlab("size") + ggplot2::ylab("year") +
       ggplot2::scale_fill_manual(
         "stage & fishway",
diff --git a/man/stacomi.Rd b/man/stacomi.Rd
index eb13dc5..0acdceb 100644
--- a/man/stacomi.Rd
+++ b/man/stacomi.Rd
@@ -4,7 +4,7 @@
 \alias{stacomi}
 \title{stacomi Main launcher for program stacomi}
 \usage{
-stacomi(database_expected=TRUE, datawd = "~", sch = "test")
+stacomi(database_expected=TRUE, datawd = tempdir(), sch = "test")
 }
 \arguments{
 \item{database_expected}{Boolean, if \code{TRUE} pre launch tests will be run to test the connection validity}
-- 
GitLab


From 0eb1b5fd705b5125f60bb1d13dd8675ea9fab610 Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Sun, 2 Mar 2025 12:26:12 +0100
Subject: [PATCH 12/13] up

---
 gitlab-ci/check.gitlab-ci.yml        | 2 +-
 gitlab-ci/update_check.gitlab-ci.yml | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gitlab-ci/check.gitlab-ci.yml b/gitlab-ci/check.gitlab-ci.yml
index 289d50d..8aa145c 100644
--- a/gitlab-ci/check.gitlab-ci.yml
+++ b/gitlab-ci/check.gitlab-ci.yml
@@ -8,7 +8,7 @@
     - mkdir -p public/check
     - |
       r -e '
-        Sys.setenv('_R_CHECK_SYSTEM_CLOCK_' = 0);
+        Sys.setenv("_R_CHECK_SYSTEM_CLOCK_" = 0);
         devtools::load_all();
         devtools::check(document = FALSE, args = "--no-tests", check_dir="public/check")
       '
diff --git a/gitlab-ci/update_check.gitlab-ci.yml b/gitlab-ci/update_check.gitlab-ci.yml
index 2e32a75..44383f0 100644
--- a/gitlab-ci/update_check.gitlab-ci.yml
+++ b/gitlab-ci/update_check.gitlab-ci.yml
@@ -7,7 +7,12 @@
   script:
     - mkdir -p public/check
     - Rscript -e 'renv::update()'
-    - r -e 'devtools::load_all();devtools::check(document = FALSE, args = "--no-tests", check_dir="public/check")'
+    - |
+      r -e '
+        Sys.setenv("_R_CHECK_SYSTEM_CLOCK_" = 0);
+        devtools::load_all();
+        devtools::check(document = FALSE, args = "--no-tests", check_dir="public/check")
+      '
   artifacts:
     when: always  
     paths:
-- 
GitLab


From c7b229680fcf955875348284323db1c57ec7e95d Mon Sep 17 00:00:00 2001
From: Laurent BEAULATON <laurent.beaulaton@ofb.gouv.fr>
Date: Sun, 2 Mar 2025 13:07:53 +0100
Subject: [PATCH 13/13] up

---
 gitlab-ci/codecov.gitlab-ci.yml | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gitlab-ci/codecov.gitlab-ci.yml b/gitlab-ci/codecov.gitlab-ci.yml
index cebbd5f..2094399 100644
--- a/gitlab-ci/codecov.gitlab-ci.yml
+++ b/gitlab-ci/codecov.gitlab-ci.yml
@@ -6,17 +6,20 @@
     - Rscript -e 'pak::pkg_install(pkg = c("covr", "DT"), upgrade = FALSE)'
     - Rscript -e 'pak::pak(pkg = ".", upgrade = FALSE)'
     - |
-      Rscript -e 'Sys.setenv("NOT_CRAN"= "true"); devtools::load_all();
-      txt_option <- paste0("options(stacomiR.dbname = '", ${PG_DB},"',
-        stacomiR.host = '", ${PG_HOST},"', 
-        stacomiR.port = '", ${PG_PORT},"', 
-        stacomiR.user = '", ${PG_USER},"', 
-        stacomiR.password = '", ${PG_USER_PASSWORD}, "')");
+      Rscript -e '
+      txt_option <- paste0("options(stacomiR.dbname = \"'${PG_DB}'\",
+        stacomiR.host = \"'${PG_HOST}'\",
+        stacomiR.port = \"'${PG_PORT}'\",
+        stacomiR.user = \"'${PG_USER}'\",
+        stacomiR.password = \"'${PG_USER_PASSWORD}'\")");
       source("gitlab-ci/helper.R");
       copier_option(
         file_path = "tests/testthat/helper.R",
         new_text = txt_option
       )
+      '
+    - |
+      Rscript -e 'Sys.setenv("NOT_CRAN"= "true"); devtools::load_all();
       covr::gitlab(quiet = FALSE)'
   coverage: '/Coverage: \d+\.\d+/' 
   artifacts:
-- 
GitLab