[Stacomir-commits] r616 - in pkg/stacomir: . R data dev dev/config doc inst/examples inst/po/fr/LC_MESSAGES man po tests/testthat vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Mar 3 13:46:55 CET 2024
Author: briand
Date: 2024-03-03 13:46:55 +0100 (Sun, 03 Mar 2024)
New Revision: 616
Modified:
pkg/stacomir/.Rbuildignore
pkg/stacomir/.Rinstignore
pkg/stacomir/DESCRIPTION
pkg/stacomir/NAMESPACE
pkg/stacomir/NEWS.md
pkg/stacomir/R/data.R
pkg/stacomir/R/fungraph.R
pkg/stacomir/R/ref_coe.R
pkg/stacomir/R/ref_dc.R
pkg/stacomir/R/ref_year.R
pkg/stacomir/R/report_annual.R
pkg/stacomir/R/report_dc.R
pkg/stacomir/R/report_df.R
pkg/stacomir/R/report_env.R
pkg/stacomir/R/report_ge_weight.R
pkg/stacomir/R/report_mig.R
pkg/stacomir/R/report_mig_env.R
pkg/stacomir/R/report_mig_interannual.R
pkg/stacomir/R/report_mig_mult.R
pkg/stacomir/R/report_sample_char.R
pkg/stacomir/R/report_sea_age.R
pkg/stacomir/R/report_silver_eel.R
pkg/stacomir/R/report_species.R
pkg/stacomir/R/stacomi.R
pkg/stacomir/R/stacomiR-package.R
pkg/stacomir/cran-comments.md
pkg/stacomir/data/r_mig.rda
pkg/stacomir/dev/03_deploy.R
pkg/stacomir/dev/config/generate_data.R
pkg/stacomir/doc/stacomir.Rmd
pkg/stacomir/inst/examples/report_dc-example.R
pkg/stacomir/inst/examples/report_mig-example.R
pkg/stacomir/inst/examples/report_mig_interannual-example.R
pkg/stacomir/inst/examples/report_mig_mult-example.R
pkg/stacomir/inst/po/fr/LC_MESSAGES/R-stacomiR.mo
pkg/stacomir/man/calcule-report_mig-method.Rd
pkg/stacomir/man/calcule-report_mig_mult-method.Rd
pkg/stacomir/man/charge-ref_choice-method.Rd
pkg/stacomir/man/charge-ref_year-method.Rd
pkg/stacomir/man/charge-report_mig_mult-method.Rd
pkg/stacomir/man/charge-report_sea_age-method.Rd
pkg/stacomir/man/charge-report_silver_eel-method.Rd
pkg/stacomir/man/choice_c-ref_year-method.Rd
pkg/stacomir/man/choice_c-report_mig_mult-method.Rd
pkg/stacomir/man/coef_durif.Rd
pkg/stacomir/man/connect-report_mig-method.Rd
pkg/stacomir/man/fun_report_mig_interannual.Rd
pkg/stacomir/man/fun_stage_durif.Rd
pkg/stacomir/man/model-report_ge_weight-method.Rd
pkg/stacomir/man/plot-report_dc-missing-method.Rd
pkg/stacomir/man/plot-report_df-missing-method.Rd
pkg/stacomir/man/plot-report_mig-ANY-method.Rd
pkg/stacomir/man/plot-report_mig_interannual-missing-method.Rd
pkg/stacomir/man/plot-report_mig_mult-missing-method.Rd
pkg/stacomir/man/plot-report_sea_age-missing-method.Rd
pkg/stacomir/man/plot-report_silver_eel-missing-method.Rd
pkg/stacomir/man/plot-report_species-missing-method.Rd
pkg/stacomir/man/print-report_mig-method.Rd
pkg/stacomir/man/r_mig.Rd
pkg/stacomir/man/ref_choice-class.Rd
pkg/stacomir/man/ref_coe-class.Rd
pkg/stacomir/man/ref_dc-class.Rd
pkg/stacomir/man/ref_df-class.Rd
pkg/stacomir/man/ref_horodate-class.Rd
pkg/stacomir/man/ref_list-class.Rd
pkg/stacomir/man/ref_par-class.Rd
pkg/stacomir/man/ref_parqual-class.Rd
pkg/stacomir/man/ref_parquan-class.Rd
pkg/stacomir/man/ref_stage-class.Rd
pkg/stacomir/man/ref_taxa-class.Rd
pkg/stacomir/man/ref_year-class.Rd
pkg/stacomir/man/report_dc-class.Rd
pkg/stacomir/man/report_mig-class.Rd
pkg/stacomir/man/report_mig_interannual-class.Rd
pkg/stacomir/man/report_mig_mult-class.Rd
pkg/stacomir/man/stacomi.Rd
pkg/stacomir/man/summary-report_mig_interannual-method.Rd
pkg/stacomir/man/supprime-report_mig_interannual-method.Rd
pkg/stacomir/man/validity_year.Rd
pkg/stacomir/man/write_database-report_mig-method.Rd
pkg/stacomir/po/R-fr.po
pkg/stacomir/po/R-stacomiR.pot
pkg/stacomir/tests/testthat/.gitignore
pkg/stacomir/tests/testthat/helper.R
pkg/stacomir/tests/testthat/test-00-functions.R
pkg/stacomir/tests/testthat/test-00-stacomir.R
pkg/stacomir/tests/testthat/test-00-zrefclasses.R
pkg/stacomir/tests/testthat/test-01-report_mig_mult.R
pkg/stacomir/tests/testthat/test-02-report_mig.R
pkg/stacomir/tests/testthat/test-03-report_df.R
pkg/stacomir/tests/testthat/test-04-report_dc.R
pkg/stacomir/tests/testthat/test-05-report_sample_char.R
pkg/stacomir/tests/testthat/test-06-report_mig_interannual.R
pkg/stacomir/tests/testthat/test-07-report_sea_age.R
pkg/stacomir/tests/testthat/test-08-report_silver_eel.R
pkg/stacomir/tests/testthat/test-09-report_annual.R
pkg/stacomir/tests/testthat/test-10-report_env.R
pkg/stacomir/tests/testthat/test-11-report_mig_env.R
pkg/stacomir/tests/testthat/test-12-report_mig_char.R
pkg/stacomir/tests/testthat/test-13-report_species.R
pkg/stacomir/tests/testthat/test-14-report_ge_weight.R
pkg/stacomir/vignettes/stacomir.Rmd
pkg/stacomir/vignettes/stacomir.html
Log:
version 0.6.0.1
Modified: pkg/stacomir/.Rbuildignore
===================================================================
--- pkg/stacomir/.Rbuildignore 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/.Rbuildignore 2024-03-03 12:46:55 UTC (rev 616)
@@ -24,3 +24,6 @@
^cran-comments.md$
tests/testhat/\~import_coe20092015\.csv
^CRAN-RELEASE$
+^public
+^ci
+^Scripts
\ No newline at end of file
Modified: pkg/stacomir/.Rinstignore
===================================================================
--- pkg/stacomir/.Rinstignore 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/.Rinstignore 2024-03-03 12:46:55 UTC (rev 616)
@@ -9,4 +9,5 @@
dev.*
^\.gitlab-ci.yml$
^LICENSE$
-^cran-comments.md$
\ No newline at end of file
+^cran-comments.md$
+public
\ No newline at end of file
Modified: pkg/stacomir/DESCRIPTION
===================================================================
--- pkg/stacomir/DESCRIPTION 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/DESCRIPTION 2024-03-03 12:46:55 UTC (rev 616)
@@ -1,108 +1,109 @@
-Package: stacomiR
-Version: 0.6.0.7
-Date: 2022-07-16
-Title: Fish Migration Monitoring
-Authors at R: c(person("Cedric", "Briand", role = c("aut", "cre"), email = "cedric.briand00 at gmail.com"),
- person("Marion", "Legrand", role = "aut", email="tableau-salt-loire at logrami.fr"),
- person("Beaulaton", "Laurent", role = "ctb", email = "laurent.beaulaton at ofb.gouv.fr"),
- person("Boulenger", "Clarisse", role = "ctb", email = "Clarisse.Boulenger at ofb.gouv.fr"),
- person("Lafage", "Denis", role = "ctb", email = "denis.lafage at logrami.fr"),
- person("Grall", "Sebastien", role = "ctb", email = "seinormigr.grall at gmail.com"))
-Description: Graphical outputs and treatment for a database of fish pass
- monitoring. It is a part of the 'STACOMI' open source project developed in
- France by the French Office for Biodiversity institute to centralize
- data obtained by fish pass monitoring. This version is available in French and
- English. See <http://stacomir.r-forge.r-project.org/> for more information on
- 'STACOMI'.
-License: GPL (>= 2)
-URL: http://stacomir.r-forge.r-project.org/
-BugReports: https://github.com/MarionLegrandLogrami/stacomiR/issues
-Collate:
- 'create_generic.R'
- 'data.R'
- 'fun_table_per_dis.R'
- 'fun_write_monthly.R'
- 'fungraph.R'
- 'fungraph_glasseel.R'
- 'funschema.R'
- 'funstat.R'
- 'funtable.R'
- 'ref_choice.R'
- 'ref_coe.R'
- 'ref_dc.R'
- 'ref_df.R'
- 'ref_env.R'
- 'ref_horodate.R'
- 'ref_list.R'
- 'ref_par.R'
- 'ref_parqual.R'
- 'ref_parquan.R'
- 'ref_period.R'
- 'ref_stage.R'
- 'ref_taxa.R'
- 'ref_textbox.R'
- 'ref_timestep.R'
- 'ref_timestep_daily.R'
- 'ref_year.R'
- 'report_annual.R'
- 'report_dc.R'
- 'report_df.R'
- 'utilities.R'
- 'report_env.R'
- 'report_ge_weight.R'
- 'report_ope.R'
- 'report_mig.R'
- 'report_sample_char.R'
- 'report_mig_char.R'
- 'report_mig_mult.R'
- 'report_mig_env.R'
- 'report_mig_interannual.R'
- 'report_sea_age.R'
- 'report_silver_eel.R'
- 'report_species.R'
- 'setAs.R'
- 'stacomi.R'
- 'stacomiR-package.R'
-LazyLoad: yes
-LazyData: true
-Depends:
- R (>= 4.0.0),
- methods,
- stacomirtools (>= 0.6.0.1)
-Imports:
- magrittr,
- intervals,
- RColorBrewer,
- stringr,
- RPostgres,
- ggplot2,
- reshape2,
- graphics,
- utils,
- stats,
- lattice,
- grDevices,
- Hmisc (>= 4.1-1),
- lubridate,
- dplyr,
- xtable,
- mgcv,
- rlang,
- pool,
- withr,
- scales
-Suggests:
- testthat,
- viridis,
- knitr,
- rmarkdown
-Author: Cedric Briand [aut, cre],
- Marion Legrand [aut],
- Beaulaton Laurent [ctb],
- Boulenger Clarisse [ctb],
- Lafage Denis [ctb],
- Grall Sebastien [ctb]
-Maintainer: Cedric Briand <cedric.briand00 at gmail.com>
-RoxygenNote: 7.2.0
-NeedsCompilation: no
-VignetteBuilder: knitr
+Package: stacomiR
+Version: 0.6.1
+Date: 2024-03-03
+Title: Fish Migration Monitoring
+Authors at R: c(person("Cedric", "Briand", role = c("aut", "cre"), email = "cedric.briand00 at gmail.com"),
+ person("Marion", "Legrand", role = "aut", email="tableau-salt-loire at logrami.fr"),
+ person("Beaulaton", "Laurent", role = "ctb", email = "laurent.beaulaton at ofb.gouv.fr"),
+ person("Boulenger", "Clarisse", role = "ctb", email = "Clarisse.Boulenger at ofb.gouv.fr"),
+ person("Lafage", "Denis", role = "ctb", email = "denis.lafage at logrami.fr"),
+ person("Grall", "Sebastien", role = "ctb", email = "seinormigr.grall at gmail.com"))
+Description: Graphical outputs and treatment for a database of fish pass
+ monitoring. It is a part of the 'STACOMI' open source project developed in
+ France by the French Office for Biodiversity institute to centralize
+ data obtained by fish pass monitoring. This version is available in French and
+ English. See <http://stacomir.r-forge.r-project.org/> for more information on
+ 'STACOMI'.
+License: GPL (>= 2)
+Encoding: UTF-8
+URL: https://forgemia.inra.fr/stacomi/stacomir
+BugReports: https://forgemia.inra.fr/stacomi/stacomir/-/issues
+Collate:
+ 'create_generic.R'
+ 'data.R'
+ 'fun_table_per_dis.R'
+ 'fun_write_monthly.R'
+ 'fungraph.R'
+ 'fungraph_glasseel.R'
+ 'funschema.R'
+ 'funstat.R'
+ 'funtable.R'
+ 'ref_choice.R'
+ 'ref_coe.R'
+ 'ref_dc.R'
+ 'ref_df.R'
+ 'ref_env.R'
+ 'ref_horodate.R'
+ 'ref_list.R'
+ 'ref_par.R'
+ 'ref_parqual.R'
+ 'ref_parquan.R'
+ 'ref_stage.R'
+ 'ref_taxa.R'
+ 'ref_textbox.R'
+ 'ref_timestep.R'
+ 'ref_timestep_daily.R'
+ 'ref_year.R'
+ 'report_annual.R'
+ 'report_dc.R'
+ 'report_df.R'
+ 'utilities.R'
+ 'report_env.R'
+ 'report_ge_weight.R'
+ 'report_ope.R'
+ 'report_mig.R'
+ 'report_sample_char.R'
+ 'report_mig_char.R'
+ 'report_mig_mult.R'
+ 'report_mig_env.R'
+ 'report_mig_interannual.R'
+ 'report_sea_age.R'
+ 'report_silver_eel.R'
+ 'report_species.R'
+ 'setAs.R'
+ 'stacomi.R'
+ 'stacomiR-package.R'
+LazyLoad: yes
+LazyData: true
+Depends:
+ R (>= 4.0.0),
+ methods,
+ stacomirtools (>= 0.6.0.1)
+Imports:
+ magrittr,
+ intervals,
+ RColorBrewer,
+ stringr,
+ RPostgres,
+ ggplot2,
+ reshape2,
+ graphics,
+ utils,
+ stats,
+ lattice,
+ grDevices,
+ Hmisc (>= 4.1-1),
+ lubridate,
+ dplyr,
+ xtable,
+ mgcv,
+ rlang,
+ pool,
+ DBI,
+ withr,
+ scales
+Suggests:
+ testthat,
+ viridis,
+ knitr,
+ rmarkdown
+Author: Cedric Briand [aut, cre],
+ Marion Legrand [aut],
+ Beaulaton Laurent [ctb],
+ Boulenger Clarisse [ctb],
+ Lafage Denis [ctb],
+ Grall Sebastien [ctb]
+Maintainer: Cedric Briand <cedric.briand00 at gmail.com>
+RoxygenNote: 7.3.1
+NeedsCompilation: no
+VignetteBuilder: knitr
Modified: pkg/stacomir/NAMESPACE
===================================================================
--- pkg/stacomir/NAMESPACE 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/NAMESPACE 2024-03-03 12:46:55 UTC (rev 616)
@@ -7,6 +7,7 @@
export(choice_c)
export(colortable)
export(envir_stacomi)
+export(fn_connect_report_mig_interannual)
export(fun_aggreg_for_plot)
export(fun_date_extraction)
export(fun_report_mig_interannual)
@@ -54,10 +55,14 @@
import(stacomirtools)
import(stringr)
import(xtable)
+importFrom(DBI,Id)
importFrom(Hmisc,capitalize)
importFrom(Hmisc,wtd.quantile)
importFrom(dplyr,across)
importFrom(dplyr,all_of)
+importFrom(dplyr,anti_join)
+importFrom(dplyr,arrange)
+importFrom(dplyr,bind_rows)
importFrom(dplyr,desc)
importFrom(dplyr,do)
importFrom(dplyr,filter)
@@ -65,6 +70,7 @@
importFrom(dplyr,group_by)
importFrom(dplyr,min_rank)
importFrom(dplyr,mutate)
+importFrom(dplyr,pull)
importFrom(dplyr,rename)
importFrom(dplyr,select)
importFrom(dplyr,summarize)
@@ -114,6 +120,7 @@
importFrom(pool,poolClose)
importFrom(reshape2,dcast)
importFrom(reshape2,melt)
+importFrom(rlang,sym)
importFrom(scales,breaks_pretty)
importFrom(stats,AIC)
importFrom(stats,as.formula)
Modified: pkg/stacomir/NEWS.md
===================================================================
--- pkg/stacomir/NEWS.md 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/NEWS.md 2024-03-03 12:46:55 UTC (rev 616)
@@ -1,16 +1,37 @@
+# stacomiR 0.6.1
+* fixed problems with Rcheck (manual, old rd artifact, tests ...)
+* fixed deprecated `aes_string` in ggplot2
+* fixed problems with arguments in two methods manual (CRAN note)
+* `report_mig` now only uses a function from `report_mig_interannual` and not longer runs its connect method, this simplifies the loading.
+* fix bug due to change in behaviour after using dbwrite table which now creates a table with local timestamp and cause
+ values to shift one day in `report_mig_interannual` when inserting from the temporary table
+* dev added information for user about the current connexion (host, dbname) in `report_mig_mult` when silent = FALSE
+* dev added info about the number of lines in `supprime (report_mig_interannual)` and `write_database (report_mig)`
+* fix bug when calling `plot(report_sample_char)` the values where always collected from envir_stacomi.
+* fix bug in plot standard report mig char.
+* test added test test coverage now increases to 85 %.
+* fix [#30](https://forgemia.inra.fr/stacomi/stacomir/-/issues/30) missing month in summary `report_mig_interannual`
+* fix problem of vignette building in mac_OSX
+* test trouble with codecovr during tests
+* fix [#31](https://forgemia.inra.fr/stacomi/stacomir/-/issues/31) Report_annual does not issue a count when no data are present in the db for one year
+* dev [#14](https://forgemia.inra.fr/stacomi/stacomir/-/issues/14) Added function to get schema list
+* dev [#19](https://forgemia.inra.fr/stacomi/stacomir/-/issues/19)Choose year of reference in `report_mig_interannual`
+* fix bug in `plot.report_mig_mult` standard some colors not printed due to changed name.
+* fix bug in plot report mig mult wrong legend for standard graph (glass eel was OK)
+
# stacomiR 0.6.0.7
* created function to load schema
-* fixed problem with report_mig_char example (broken since new qualitative parameter for age was inserted in the database)
+* fixed problem with `report_mig_char` example (broken since new qualitative parameter for age was inserted in the database)
* fixed problem with x scale ugly https://forgemia.inra.fr/stacomi/stacomir/-/issues/27 fixed
# stacomiR 0.6.0.6
-* allows to load ggplots after plot for report_dc and report_df
+* allows to load ggplots after plot for `report_dc` and `report_df`
* fixes the problem of method for plot no longer working with signature(x = "report_dc", y = "ANY") and changed to
"missing"
-* allows to pass arguments for colors in plot.report_dc
+* allows to pass arguments for colors in `plot.report_dc`
* fixed problems with broken translation see https://forgemia.inra.fr/stacomi/stacomir/-/issues/20
# stacomiR 0.6.0.5
Modified: pkg/stacomir/R/data.R
===================================================================
--- pkg/stacomir/R/data.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/data.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -42,10 +42,10 @@
"r_mig_mult"
-#' Video counting of thin lipped mullet (Liza ramada) in 2015 in the Vilaine (France)
+#' Video counting of Marine lamprey (Petromyzon marinus) in 2012 in the Vilaine (France)
#'
#' This dataset corresponds to the data collected at the vertical slot fishway
-#' in 2015, video recording of the thin lipped mullet Liza ramada migration
+#' in 2012, video recording marine lamprey migration
#'
#' @format An object of class report_mig with 8 slots:
#' \describe{
@@ -279,7 +279,7 @@
#' @references Durif, C.M., Guibert, A., and Elie, P. 2009.
#' Morphological discrimination of the silvering stages of the European eel.
#' In American Fisheries Society Symposium. pp. 103-111.
-#' \url{http://fishlarvae.org/common/SiteMedia/durif\%20et\%20al\%202009b.pdf}
+#' \url{https://fishlarvae.org/common/SiteMedia/durif\%20et\%20al\%202009b.pdf}
"coef_durif"
#' Wet weight of glass eel from the trapping ladder (Arzal, Vilaine France)
Modified: pkg/stacomir/R/fungraph.R
===================================================================
--- pkg/stacomir/R/fungraph.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/fungraph.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -46,7 +46,7 @@
"stopped" = tp[6],
"Fonc normal" = tp[1],
"Arr ponctuel" = tp[2],
- "Arr maintenance" = tp[3],
+ "Arr maint" = tp[3],
"Dysfonc" = tp[5],
"Non connu" = tp[7],
"ponctuel" = "indianred",
@@ -62,7 +62,7 @@
"stopped" = color[2],
"Fonc normal" = color[3],
"Arr ponctuel" = color[4],
- "Arr maintenance" = color[5],
+ "Arr maint" = color[5],
"Dysfonc" = color[6],
"Non connu" = color[7],
"mesure" = color[8],
@@ -355,30 +355,29 @@
color= mypalette[report_df at data$libelle],
date = FALSE
)
- nomperiode <- vector()
- color_periodes <-
- vector() # a vector of colors, one per period type in listeperiode
+ nom_periodes <- vector()
+ color_periodes <- vector() # a vector of colors, one per period type in listeperiode
for (j in 1:length(listeperiode)) {
#recuperation du vecteur de noms (dans l'ordre) e partir de la liste
- nomperiode[j] <- substr(listeperiode[[j]]$nom, 1, 17)
+ nom_periodes[j] <- substr(listeperiode[[j]]$nom, 1, 17)
#ecriture pour chaque type de periode
- color_periode = listeperiode[[j]]$color
+ color_periodes[j] = listeperiode[[j]]$color
rect(
xleft = graphdate(listeperiode[[j]]$debut),
ybottom = 1.1,
xright = graphdate(listeperiode[[j]]$fin),
ytop = 2,
- col = color_periode,
+ col = color_periodes[j],
border = NA,
lwd = 1
)
- color_periodes <- c(color_periodes, color_periode)
+
}
legend (
x = debut,
y = 1.2,
- legend = c(gettext("stop", domain = "R-stacomiR"), nomperiode),
+ legend = c(gettext("working", domain = "R-stacomiR"),gettext("stop", domain = "R-stacomiR"), nom_periodes),
pch = c(15, 15),
col = c(mypalette["working"], mypalette["stopped"], color_periodes),
bty = "n",
@@ -478,17 +477,17 @@
color= mypalette[report_df at data$libelle],
date = FALSE
)
- nomperiode <- vector()
+ nom_periodes <- vector()
color_periodes <- vector()
for (j in 1:length(listeperiode)) {
- nomperiode[j] <- substr(listeperiode[[j]]$nom, 1, 17)
- color_periode <- listeperiode[[j]]$color
+ nom_periodes[j] <- substr(listeperiode[[j]]$nom, 1, 17)
+ color_periodes[j] <- listeperiode[[j]]$color
rect(
xleft = graphdate(listeperiode[[j]]$debut),
ybottom = 1.1,
xright = graphdate(listeperiode[[j]]$fin),
ytop = 2,
- col = color_periode,
+ col = color_periodes[j],
border = NA,
lwd = 1
)
@@ -497,7 +496,7 @@
legend (
x = debut,
y = 1.2,
- legend = gettext("working", "stopped", nomperiode, domain = "R-stacomiR"),
+ legend = gettext("working", "stopped", nom_periodes, domain = "R-stacomiR"),
pch = c(15, 15),
col = c(mypalette["working"], mypalette["stopped"], color_periodes),
bty = "n",
Modified: pkg/stacomir/R/ref_coe.R
===================================================================
--- pkg/stacomir/R/ref_coe.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/ref_coe.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -68,7 +68,7 @@
"WITH deleted AS (",
"DELETE FROM ", get_schema(), "tj_coefficientconversion_coe ",
"WHERE coe_date_debut >= '",object at datedebut,"'",
- " AND coe_date_fin <= '", object at datefin, "'",
+ " AND coe_date_debut <= '", object at datefin, "'",
" AND coe_tax_code='", tax, "' and coe_std_code='", std,
"' and coe_qte_code='1'",
" RETURNING *)",
Modified: pkg/stacomir/R/ref_dc.R
===================================================================
--- pkg/stacomir/R/ref_dc.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/ref_dc.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -91,20 +91,21 @@
"t_dispositiffranchissement_dif ON dif_dis_identifiant=dic_dif_identifiant",
" JOIN ",
get_schema(),
- "tj_dfesttype_dft ON dif_dis_identifiant=dft_df_identifiant",
- " JOIN ",
- get_schema(),
"t_ouvrage_ouv on dif_ouv_identifiant=ouv_identifiant",
" JOIN ",
get_schema(),
"t_station_sta on ouv_sta_code=sta_code",
+ " JOIN ref.tr_typedc_tdc ON dic_tdc_code=tdc_code",
+ " LEFT JOIN (SELECT * FROM ",
+ get_schema(),
+ "tj_dfesttype_dft",
" JOIN ref.tr_typedf_tdf ON tdf_code=dft_tdf_code",
- " JOIN ref.tr_typedc_tdc ON dic_tdc_code=tdc_code",
- " WHERE dft_rang=1",
+ " WHERE dft_rang=1) sub ON dif_dis_identifiant=dft_df_identifiant",
" ORDER BY dis_identifiant;",
sep = ""
)
requete <- stacomirtools::query(requete)
+ if (grepl("Error",requete at status)) stop(requete at status)
# funout(gettext('The query to load counting devices is done
# \n',domain='R-stacomiR'))
object at data <- requete at query
Modified: pkg/stacomir/R/ref_year.R
===================================================================
--- pkg/stacomir/R/ref_year.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/ref_year.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -5,7 +5,7 @@
#'
#' @param object An object of class \code{\linkS4class{ref_year}}
#' @return boolean The test for the object refannee
-#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
+#' @author Cedric Briand \email{cedric.briand at eptb-vilaine.fr}
#' @keywords internal
validity_year = function(object)
{
@@ -26,7 +26,7 @@
#' @slot year_selected A numeric vector
#' @keywords classes
#' @family referential objects
-#' @author cedric.briand"at"eptb-vilaine.fr
+#' @author cedric.briand at eptb-vilaine.fr
setClass(
Class = "ref_year",
representation =
@@ -41,7 +41,7 @@
#' @param object An object of class \link{ref_year-class}
#' @param objectreport The object report, default \code{report_ge_weight} other possible value report_mig_interannual
#' @return object An object of class \link{ref_year-class} with slot data filled with the available years for the corresponding report
-#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
+#' @author Cedric Briand \email{cedric.briand at eptb-vilaine.fr}
#' @examples
#' \dontrun{
#' object=new("ref_year")
@@ -159,7 +159,7 @@
#'
#' The choice_c method will issue a warning if the year is not present in the database
#' Allows the selection of year and the assignment in environment envir_stacomi
-#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
+#' @author Cedric Briand \email{cedric.briand at eptb-vilaine.fr}
#' @param object An object of class \link{ref_year-class}
#' @param annee The year to select, either as a character or as a numeric
#' @param nomassign The name to be assigned in envir_stacomi
Modified: pkg/stacomir/R/report_annual.R
===================================================================
--- pkg/stacomir/R/report_annual.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/report_annual.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -116,6 +116,7 @@
#' @return An instantiated object with values filled with user choice
#' @author Cedric Briand \email{cedric.briand at eptb-vilaine.fr}
#' @return An object of class \link{report_annual-class} including a dataframe with column effectif, comprising the sum of report_mig counts
+#' @importFrom dplyr anti_join arrange bind_rows
#' @aliases connect.report_annual
setMethod(
"connect",
@@ -142,7 +143,7 @@
"t_lot_lot on lot_ope_identifiant=ope_identifiant
where ope_dic_identifiant in ",
dc,
- " and extract(year from ope_date_debut)>=",
+ " and extract(year from ope_date_fin)>=",
start_year,
" and extract(year from ope_date_debut)<=",
end_year,
@@ -241,8 +242,23 @@
)
req at sql <- stringr::str_replace_all(req at sql, "[\r\n\t]" , "")
req <- stacomirtools::query(req)
- r_ann at data = getquery(req)
-
+ resdata <- getquery(req)
+
+ all_comb <- expand.grid(
+ annee = start_year:end_year,
+ ope_dic_identifiant = r_ann at dc@dc_selected,
+ lot_tax_code = r_ann at taxa@taxa_selected,
+ lot_std_code = r_ann at stage@stage_selected
+ )
+ missing <- dplyr::anti_join(all_comb,resdata[,c("annee", "ope_dic_identifiant", "lot_tax_code",
+ "lot_std_code")], by = c("annee", "ope_dic_identifiant", "lot_tax_code", "lot_std_code"))
+ if (nrow(missing) > 0){
+ missing$effectif = 0
+ r_ann at data <- dplyr::bind_rows(resdata,missing)
+ } else {
+ r_ann at data <- resdata
+ }
+ r_ann at data <- dplyr::arrange(r_ann at data,ope_dic_identifiant, lot_tax_code, lot_std_code, annee)
}
return(r_ann)
}
@@ -533,7 +549,7 @@
legend.text = dat0$ope_dic_identifiant
barplot(mat, legend.text = legend.text, ...)
} else {
- barplot(mat, ...)
+ barplot(mat, legend.text=legend.text)
}
} else if (length(lestax) == 1 & length(lesdic) == 1) {
Modified: pkg/stacomir/R/report_dc.R
===================================================================
--- pkg/stacomir/R/report_dc.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/report_dc.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -186,7 +186,7 @@
#' Different plots for report_dc
#'
-#' \itemize{
+#' \describe{
#' \item{plot.type=1}{A barplot of the operation time per month}
#' \item{plot.type=2}{Barchat giving the time per type of operation }
#' \item{plot.type=2}{Rectangle plots drawn along a line}
Modified: pkg/stacomir/R/report_df.R
===================================================================
--- pkg/stacomir/R/report_df.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/report_df.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -191,7 +191,7 @@
#' Different plots for report_df
#'
-#' \itemize{
+#' \describe{
#' \item{plot.type=1}{A barplot of the operation time per month}
#' \item{plot.type=2}{Barchat giving the time per type of operation }
#' \item{plot.type=2}{Rectangle plots drawn along a line}
Modified: pkg/stacomir/R/report_env.R
===================================================================
--- pkg/stacomir/R/report_env.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/report_env.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -140,7 +140,7 @@
1, just = "center")))
lesGraphes = list()
if (length(unique(dat$env_stm_identifiant)) != nrow(r_env at stationMesure@data)) {
- funout(gettext("Some monitoring stations lack associated values (no environmental data)\n",
+ if(!silent) funout(gettext("Some monitoring stations lack associated values (no environmental data)\n",
domain = "R-stacomiR"))
}
@@ -157,11 +157,10 @@
# all measures for the selected station
nameColonne <- as.character(stm$stm_libelle)
datstm <- stacomirtools::chnames(dat, "env_valeur_quantitatif", nameColonne)
- datstm <- datstm[datstm$env_stm_identifiant == stmidentifiant, ]
-
+ datstm <- datstm[datstm$env_stm_identifiant == stmidentifiant, ]
# creating the plot
- g <- ggplot(datstm, aes_string(x = "env_date_debut", y = nameColonne))
- g <- g + geom_line(aes_string(colour = nameColonne)) + scale_y_continuous(stm$stm_libelle) +
+ g <- ggplot(datstm, aes(x = env_date_debut, y = !!rlang::sym(nameColonne)))
+ g <- g + geom_line(aes(colour = !!rlang::sym(nameColonne))) + scale_y_continuous(stm$stm_libelle) +
scale_x_datetime(name = "date")
# printing plot on screen
@@ -168,7 +167,7 @@
print(g, vp = vplayout(i, 1))
}
} else {
- funout(gettext("No environmental conditions values for selected monitoring stations (report_env.R)\n",
+ if(!silent) funout(gettext("No environmental conditions values for selected monitoring stations (report_env.R)\n",
domain = "R-stacomiR"), arret = TRUE)
}
return(invisible(NULL))
Modified: pkg/stacomir/R/report_ge_weight.R
===================================================================
--- pkg/stacomir/R/report_ge_weight.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/report_ge_weight.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -221,12 +221,12 @@
#' @return An object of class \link{report_ge_weight-class} with \code{@calcdata[["import_coe"]]} filled.
#' @details
#' Depending on model.type several models are produced
-#' \itemize{
-#'\item{model.type='seasonal'.}{ The simplest model uses a seasonal variation, it is
+#' \describe{
+#'\item{model.type='seasonal'.}{The simplest model uses a seasonal variation, it is
#' fitted with a sine wave curve allowing a cyclic variation
#' w ~ a*cos(2*pi*(d'-T)/365)+b with a period T. The modified day d' used is this model is set
#' at 1 the 1st of august doy = d' + d0; d0 = 212, doy=julian days}
-#'\item{model.type='seasonal1'.}{ A time component is introduced in the model, which allows
+#'\item{model.type='seasonal1'.}{A time component is introduced in the model, which allows
#' for a long term variation along with the seasonal variation. This long term variation is
#' is fitted with a gam, the time variable is set at zero at the beginning of the first day of observed values.
#' The seasonal variation is modeled on the same modified julian time as model.type='seasonal'
@@ -237,7 +237,7 @@
#' curve similar to the sine curve used in seasonal. The formula for this is \eqn{sin(\omega vt) + cos(\omega vt)}{sin(omega vt) + cos(omega vt)},
#' where vt is the time index variable \eqn{\omega}{omega} is a constant that describes how the index variable relates to the full period
#' (here, \eqn{2\pi/365=0.0172}{2pi/365=0.0172}). The model is written as following \eqn{w~cos(0.0172*doy)+sin(0.0172*doy)+s(time).}}
-#'\item{model.type='manual'.}{ The dataset don (the raw data), coe (the coefficients already present in the
+#'\item{model.type='manual'.}{The dataset don (the raw data), coe (the coefficients already present in the
#' database, and newcoe the dataset to make the predictions from, are written to the environment envir_stacomi.
#' please see example for further description on how to fit your own model, build the table of coefficients,
#' and write it to the database.}
Modified: pkg/stacomir/R/report_mig.R
===================================================================
--- pkg/stacomir/R/report_mig.R 2022-07-17 16:11:57 UTC (rev 615)
+++ pkg/stacomir/R/report_mig.R 2024-03-03 12:46:55 UTC (rev 616)
@@ -71,24 +71,6 @@
rep6 , TRUE , c(1:6)[!c(rep1, rep2, rep3, rep4, rep5, rep6)]))
})
-#deprecated0.6
-##' handler for calculations report_mig
-##'
-##' internal use
-##' @param h handler
-##' @param ... additional parameters
-##' @author Cedric Briand \email{cedric.briand at eptb-vilaine.fr}
-##' @keywords internal
-#h_report_migcalc=function(h,...){
-# if (exists("report_mig",envir_stacomi)) {
-# report_mig<-get("report_mig",envir_stacomi)
-# } else {
-# funout(gettext("You need to launch computation first, clic on calc\n",domain="R-stacomiR"),arret=TRUE)
-# }
-# report_mig<-charge(report_mig)
-# report_mig<-connect(report_mig)
-# report_mig<-calcule(report_mig)
-#}
#' connect method for report_mig
#'
@@ -129,7 +111,7 @@
signature = signature("report_mig"),
definition = function(object, dc, taxa, stage, datedebut, datefin) {
# code for debug using r_mig example
- #report_mig<-r_mig;dc=5;taxa="Liza ramada";stage="IND";datedebut="2015-01-01";datefin="2015-12-31"
+ #report_mig<-r_mig;dc=5;taxa="Chelon ramada";stage="IND";datedebut="2015-01-01";datefin="2015-12-31"
report_mig <- object
report_mig at dc = charge(report_mig at dc)
# loads and verifies the dc
@@ -291,7 +273,7 @@
#' method is "overlaps" as the latter method uses the overlap package to split migration period.}
#' \item{data}{the calculated data.}
#' \item{contient_poids}{A boolean which indicates, in the case of glass eel, that the function \link{fun_weight_conversion} has been run to convert the weights to numbers using the weight
-#' to number coefficients in the database (see link{report_ge_weight}).}
+#' to number coefficients in the database (see \link{report_ge_weight}).}
#' \item{negative}{A parameter indicating if negative migration (downstream in the case of upstream migration devices) have been converted to positive numbers,
#' not developed yet}}
#' @aliases calcule.report_mig
@@ -427,23 +409,6 @@
)
-#deprecated0.6
-##' handler to print the command line
-##' @param h a handler
-##' @param ... Additional parameters
-##' @author Cedric Briand \email{cedric.briand at eptb-vilaine.fr}
-##' @keywords internal
-#houtreport_mig=function(h=null,...) {
-# if (exists("ref_stage",envir_stacomi)) {
-# report_mig<-get("report_mig",envir_stacomi)
-# print(report_mig)
-# }
-# else
-# {
-# funout(gettext("Please select DC, taxa, and stages for a complete command\n",domain="R-stacomiR"),arret=TRUE)
-# }
-#}
-
#' Method to print the command line of the object
#' @param x An object of class report_mig
#' @param ... Additional parameters passed to print
@@ -484,7 +449,7 @@
#' Plots of various type for report_mig.
#'
-#' \itemize{
+#' \describe{
#' \item{plot.type="standard"}{calls \code{\link{fungraph}} and \code{\link{fungraph_glasseel}} functions to plot as many "report_mig"
#' as needed, the function will test for the existence of data for one dc, one taxa, and one stage}
#' \item{plot.type="step"}{creates Cumulated graphs for report_mig_mult. Data are summed per day for different dc taxa and stages}
@@ -707,9 +672,7 @@
#' Daily values are needed to compare migrations from year to year, by the class \link{report_mig_interannual-class}. They are added by
#' by this function.
#' @param object an object of class \linkS4class{report_mig}
-#' @param silent : TRUE to avoid messages
-#' @param check_for_bjo : do you want to check if data are already present in the bjo table, and delete them,
-#' this param was added otherwise connect method when called from report_mig_interannual runs in loops
+#' @param silent : TRUE to avoid messages, FALSE will need interactive mode as it calls for menu()
#' @note the user is asked whether or not he wants to overwrite data only when silent is FALSE, if no
#' data are present in the database, the import is done anyway.
#' @return Nothing, just writes data into the database
@@ -722,14 +685,15 @@
#' write_database(report_mig=r_mig,silent=FALSE)
#' }
#' @aliases write_database.report_mig
+#' @importFrom DBI Id
#' @export
setMethod(
"write_database",
signature = signature("report_mig"),
definition = function(object,
- silent = TRUE,
- check_for_bjo = TRUE) {
- # object=bM
+ silent = TRUE
+ ) {
+ # object=bM
report_mig <- object
if (!inherits(report_mig, "report_mig"))
stop("the report_mig should be of class report_mig")
@@ -738,9 +702,9 @@
dc = as.numeric(report_mig at dc@dc_selected)[1]
data = report_mig at calcdata[[stringr::str_c("dc_", dc)]][["data"]]
# keep one line if there is one species in one day with as much up as down...
- if (nrow(data) > 1)
- data = data[data$Effectif_total != 0, ]
- jour_dans_lannee_non_nuls = data$debut_pas
+ # TEST 2024 #if (nrow(data) > 1)
+ # TEST 2024 data = data[data$Effectif_total != 0, ]
+ jour_dans_lannee = data$debut_pas
col_a_retirer = match(c("No.pas", "type_de_quantite", "debut_pas", "fin_pas"),
colnames(data))
col_a_retirer = col_a_retirer[!is.na(col_a_retirer)] # as in the case of glass eel and weight
@@ -771,21 +735,8 @@
report_mig at dc@dc_selected,
report_mig at taxa@taxa_selected,
report_mig at stage@stage_selected,
- annee,
- # une valeur
- rep(jour_dans_lannee_non_nuls, ncol(data[, c(
- "MESURE",
- "CALCULE",
- "EXPERT",
- "PONCTUEL",
- "Effectif_total",
- "Effectif_total.p",
- "Effectif_total.e",
- "poids_depuis_effectifs",
- "Poids_total",
- "taux_d_echappement",
- "coe_valeur_coefficient"
- )])),
+ annee,
+ rep(jour_dans_lannee, 11),
utils::stack(data[, c(
"MESURE",
"CALCULE",
@@ -808,15 +759,7 @@
report_mig at stage@stage_selected,
annee,
# une valeur
- rep(jour_dans_lannee_non_nuls, ncol(data[, c(
- "MESURE",
- "CALCULE",
- "EXPERT",
- "PONCTUEL",
- "Effectif_total",
- "taux_d_echappement",
- "coe_valeur_coefficient"
- )])),
+ rep(jour_dans_lannee, 7),
utils::stack(data[, c(
"MESURE",
"CALCULE",
@@ -849,39 +792,62 @@
# Ci dessous conversion de la classe vers migration Interannuelle pour utiliser
# les methodes de cette classe
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/stacomir -r 616
More information about the Stacomir-commits
mailing list