[Stacomir-commits] r608 - in pkg/stacomir: R dev dev/cran-comments man man/figures po
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Nov 16 10:32:32 CET 2021
Author: briand
Date: 2021-11-16 10:32:32 +0100 (Tue, 16 Nov 2021)
New Revision: 608
Added:
pkg/stacomir/dev/cran-comments/cran-comments-v0.6.0.md
pkg/stacomir/man/get_org.Rd
pkg/stacomir/man/get_schema.Rd
pkg/stacomir/po/R-stacomiR_fr_FR.po
Modified:
pkg/stacomir/R/create_generic.R
pkg/stacomir/R/data.R
pkg/stacomir/R/fun_write_monthly.R
pkg/stacomir/R/fungraph.R
pkg/stacomir/R/fungraph_glasseel.R
pkg/stacomir/R/ref_coe.R
pkg/stacomir/R/ref_dc.R
pkg/stacomir/R/ref_df.R
pkg/stacomir/R/ref_env.R
pkg/stacomir/R/ref_horodate.R
pkg/stacomir/R/ref_list.R
pkg/stacomir/R/ref_par.R
pkg/stacomir/R/ref_parqual.R
pkg/stacomir/R/ref_parquan.R
pkg/stacomir/R/ref_stage.R
pkg/stacomir/R/ref_taxa.R
pkg/stacomir/R/ref_timestep.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_char.R
pkg/stacomir/R/report_mig_interannual.R
pkg/stacomir/R/report_mig_mult.R
pkg/stacomir/R/report_ope.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/setAs.R
pkg/stacomir/R/stacomi.R
pkg/stacomir/R/utilities.R
pkg/stacomir/dev/02_dev.R
pkg/stacomir/dev/03_deploy.R
pkg/stacomir/man/calcule-report_ge_weight-method.Rd
pkg/stacomir/man/charge-ref_list-method.Rd
pkg/stacomir/man/charge-ref_par-method.Rd
pkg/stacomir/man/charge-report_species-method.Rd
pkg/stacomir/man/charge_complement-ref_parqual-method.Rd
pkg/stacomir/man/charge_with_filter-ref_par-method.Rd
pkg/stacomir/man/charge_with_filter-ref_parqual-method.Rd
pkg/stacomir/man/charge_with_filter-ref_parquan-method.Rd
pkg/stacomir/man/charge_with_filter-ref_stage-method.Rd
pkg/stacomir/man/charge_with_filter-ref_taxa-method.Rd
pkg/stacomir/man/choice_c-ref_horodate-method.Rd
pkg/stacomir/man/choice_c-ref_list-method.Rd
pkg/stacomir/man/choice_c-ref_par-method.Rd
pkg/stacomir/man/connect-report_ge_weight-method.Rd
pkg/stacomir/man/figures/README-rmmmult-1.png
pkg/stacomir/man/figures/README-rmmstd-1.png
pkg/stacomir/man/figures/README-silver-1.png
pkg/stacomir/man/plot-report_ge_weight-missing-method.Rd
pkg/stacomir/man/r_mig_interannual.Rd
pkg/stacomir/man/r_mig_mult_dc.Rd
pkg/stacomir/man/ref_dc-class.Rd
pkg/stacomir/man/ref_df-class.Rd
pkg/stacomir/man/ref_year-class.Rd
pkg/stacomir/man/summary-report_species-method.Rd
pkg/stacomir/man/write_database-report_sea_age-method.Rd
pkg/stacomir/man/xtable-report_annual-method.Rd
pkg/stacomir/po/R-stacomiR.pot
pkg/stacomir/po/R-stacomiR_fr_FR.mo
Log:
fixing check, documentation ...
Modified: pkg/stacomir/R/create_generic.R
===================================================================
--- pkg/stacomir/R/create_generic.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/create_generic.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -57,12 +57,6 @@
#' @author cedric.briand
#' @export
setGeneric("getvalue", def = function(object, ...) standardGeneric("getvalue"))
-#' Generic method to forward outputs
-#' @param object Object
-#' @param ... Additional parms
-#' @author cedric.briand
-#' @export
-setGeneric("createmessage", def = function(object, ...) standardGeneric("createmessage"))
#' Generic method to transform quantitative par into a qualitative one
#' @param object Object
#' @param ... Additional parms
@@ -79,59 +73,7 @@
standardGeneric("end_date")
)
-#' Generic method for getting the beginning date for current time step
-#' @param object An object
-#' @param ... Additional parameters passed to the method
-#' @keywords internal
-setGeneric(
- "currentstart_date",
- def = function(object, ...)
- standardGeneric("currentstart_date")
-)
-#' Generic method for getting the ending date for current time step
-#' @param object An object
-#' @param ... Additional parameters passed to the method
-#' @keywords internal
-setGeneric(
- "current_end_date",
- def = function(object, ...)
- standardGeneric("current_end_date")
-)
-
-
-#' Generic method the get starting date
-#' @param object An object
-#' @param ... Additional parameters passed to the method
-#' @keywords internal
-setGeneric(
- "getdateDebut",
- def = function(object, ...)
- standardGeneric("getdateDebut")
-)
-
-#' Generic method to set the starting date
-#' @param object An object
-#' @param ... Additional parameters passed to the method
-#' @keywords internal
-setGeneric(
- "set_starting_date",
- def = function(object, ...)
- standardGeneric("set_starting_date")
-)
-
-
-#' Generic method to get the string value of time step
-#' @param object An object
-#' @param ... Additional parameters passed to the method
-#' @keywords internal
-setGeneric(
- "get_step_label",
- def = function(object, ...)
- standardGeneric("get_step_label")
-)
-
-
#' Generic method to get the years
#' @param object An object
#' @param ... Additional parameters passed to the method
Modified: pkg/stacomir/R/data.R
===================================================================
--- pkg/stacomir/R/data.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/data.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -108,7 +108,7 @@
#' }
#' \item{dc}{the \code{ref_dc} the DC with 4 slots
#' \describe{
-#' \item{dc_selectionne}{the selected device}
+#' \item{dc_selected}{the selected device}
#' \item{ouvrage}{the dam}
#' \item{station}{the monitoring station, a section of river}
#' \item{data}{A dataset of all dc present in the database with 10 observations}
@@ -236,7 +236,8 @@
#' operational at the same location and provides one of the longest series of eel migration.
#' For this reason,
#' the dataset has been loaded as an example for the report_mig_interannual-class. It has been
-#' kindly provided by the parc du Marais Poitevin.
+#' kindly provided by the parc du Marais Poitevin. The stage corresponds to small eels (elvers)
+#' less than 150 mmm stage name 'PANG'
#' @format An object of class \link{report_mig_interannual-class} with data loaded.
#' @keywords data
"r_mig_interannual"
Modified: pkg/stacomir/R/fun_write_monthly.R
===================================================================
--- pkg/stacomir/R/fun_write_monthly.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/fun_write_monthly.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -13,7 +13,7 @@
# below not the most elegant way to do it but efficient
t_reportmigrationmensuel_bme=stacomirtools::killfactor(
- cbind(report_mig at dc@dc_selectionne,
+ cbind(report_mig at dc@dc_selected,
report_mig at taxa@data$tax_code,
report_mig at stage@data$std_code,
unique(strftime(as.POSIXlt(report_mig at time.sequence),"%Y")), # une valeur
@@ -20,7 +20,7 @@
rep(rownames(resum),(ncol(resum)-2)), # nb of month except columns report and label
stack(resum, select=c(2:(ncol(resum)-1))),# stack re-ordonne les tab de donnees !
format(Sys.time(), "%Y-%m-%d %H:%M:%S"),
- substr(toupper(rlang::env_get(envir_stacomi, "sch")), 1, nchar(toupper(rlang::env_get(envir_stacomi, "sch")))-1)
+ get_org()
)
)
@@ -31,7 +31,7 @@
# ecriture dans la base...
for (i in 1:nrow(t_reportmigrationmensuel_bme)) {
- sql=paste("INSERT INTO ",rlang::env_get(envir_stacomi, "sch"),"t_bilanmigrationmensuel_bme (",
+ sql=paste("INSERT INTO ",get_schema(),"t_bilanmigrationmensuel_bme (",
"bme_dis_identifiant,bme_tax_code,bme_std_code,bme_annee,bme_labelquantite,bme_valeur,bme_mois,bme_horodateexport,bme_org_code)",
" VALUES ('",paste(t_reportmigrationmensuel_bme[i,],collapse="','"),"');",sep="")
con <- new("ConnectionDB")
Modified: pkg/stacomir/R/fungraph.R
===================================================================
--- pkg/stacomir/R/fungraph.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/fungraph.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -79,7 +79,7 @@
}
if (is.null(dc))
- dc = report_mig at dc@dc_selectionne[1]
+ dc = report_mig at dc@dc_selected[1]
annee = unique(strftime(as.POSIXlt(time.sequence), "%Y"))[1]
mois = months(time.sequence)
jour = strftime(as.POSIXlt(time.sequence), "%j")
Modified: pkg/stacomir/R/fungraph_glasseel.R
===================================================================
--- pkg/stacomir/R/fungraph_glasseel.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/fungraph_glasseel.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -79,7 +79,7 @@
}
if (is.null(dc))
- dc = report_mig at dc@dc_selectionne[1]
+ dc = report_mig at dc@dc_selected[1]
annee = paste(unique(strftime(as.POSIXlt(time.sequence), "%Y")), collapse =
",")
mois = months(time.sequence)
Modified: pkg/stacomir/R/ref_coe.R
===================================================================
--- pkg/stacomir/R/ref_coe.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/ref_coe.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -18,7 +18,7 @@
#' @family referential objects
#' @keywords classes
setClass(Class = "ref_coe", representation = representation(data = "data.frame",
- datedebut = "POSIXlt", datefin = "POSIXlt"), prototype = prototype(data = data.frame()))
+ datedebut = "POSIXlt", datefin = "POSIXlt"), prototype = prototype(data = data.frame()))
#' loads the coefficients for the period defined in class
#'
@@ -35,19 +35,18 @@
#' charge(object)
#' }
setMethod("charge", signature = signature("ref_coe"), definition = function(object) {
- requete = new("RequeteDBwheredate")
- requete at datedebut = object at datedebut
- requete at datefin = object at datefin
- requete at colonnedebut = "coe_date_debut"
- requete at colonnefin = "coe_date_fin"
- requete at datefin = as.POSIXlt(object at datefin)
- requete at select = stringr::str_c("select * from ", rlang::env_get(envir_stacomi,
- "sch"), "tj_coefficientconversion_coe")
- requete at and = " and coe_tax_code='2038' and coe_std_code='CIV' and coe_qte_code='1'"
- requete <- query(requete)
- object at data <- requete at query
- return(object)
-})
+ requete = new("RequeteDBwheredate")
+ requete at datedebut = object at datedebut
+ requete at datefin = object at datefin
+ requete at colonnedebut = "coe_date_debut"
+ requete at colonnefin = "coe_date_fin"
+ requete at datefin = as.POSIXlt(object at datefin)
+ requete at select = stringr::str_c("select * from ", get_schema(), "tj_coefficientconversion_coe")
+ requete at and = " and coe_tax_code='2038' and coe_std_code='CIV' and coe_qte_code='1'"
+ requete <- query(requete)
+ object at data <- requete at query
+ return(object)
+ })
#' supprime method for 'ref_coe' class
@@ -59,24 +58,27 @@
#' @author Cedric Briand \email{cedric.briand'at'eptb-vilaine.fr}
#' @export
setMethod("supprime", signature = signature("ref_coe"), definition = function(object,
- tax, std, silent = FALSE) {
- # object<-r_gew at coe;tax=2038;std='CIV' getting the data to import
+ tax, std, silent = FALSE) {
+ # object<-r_gew at coe;tax=2038;std='CIV' getting the data to import
+
+ # here I assume that dc_selected will be unique (no report with several
+ # dc)
+ req = new("RequeteDB")
+ req at sql <- stringr::str_c(
+ "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_tax_code='", tax, "' and coe_std_code='", std,
+ "' and coe_qte_code='1'",
+ " RETURNING *)",
+ " SELECT * FROM deleted"
+ )
+ del <- stacomirtools::getquery(query(req))
+ nr <- nrow(del)
+ if (!silent)
+ funout(gettextf("%s rows deleted from table tj_coefficientconversion_coe",
+ nr, domain = "R-stacomiR"))
+ return(invisible(NULL))
+ })
- # here I assume that dc_selectionne will be unique (no report with several
- # dc)
- requete = new("RequeteDBwheredate")
- requete at datedebut <- object at datedebut
- requete at datefin <- object at datefin
- requete at colonnedebut <- "coe_date_debut"
- requete at colonnefin <- "coe_date_fin"
- requete at select = stringr::str_c("DELETE from ", rlang::env_get(envir_stacomi,
- "sch"), "tj_coefficientconversion_coe ")
- requete at and = str_c(" and coe_tax_code='", tax, "' and coe_std_code='", std,
- "' and coe_qte_code='1'")
- requete <- stacomirtools::query(requete)
- if (!silent)
- funout(gettextf("%s rows deleted from table tj_coefficientconversion_coe",
- nrow(object at data), domain = "R-stacomiR"))
- return(invisible(NULL))
-})
-
Modified: pkg/stacomir/R/ref_dc.R
===================================================================
--- pkg/stacomir/R/ref_dc.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/ref_dc.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -3,13 +3,13 @@
#' Description of a control device.
#'
#' @include create_generic.R
-#' @slot dc_selectionne Object of class \code{'integer'}, The selected device
+#' @slot dc_selected Object of class \code{'integer'}, The selected device
#' @slot ouvrage Object of class \code{'integer'}, the attached dam
#' @slot station Object of class \code{'character'}, the attached migration monitoring station, this is necessary to join the
#' table of escapements calculated at the station level.
#' @slot data Object of class \code{'data.frame'} data pertaining to the control device
#' @section Objects from the Class: Objects can be created by calls of the form
-#' \code{new('ref_dc', dc_selectionne=integer(), ouvrage=integer(),
+#' \code{new('ref_dc', dc_selected=integer(), ouvrage=integer(),
#' data=data.frame())}.
#' @author cedric.briand'at'eptb-vilaine.fr
#' @keywords classes
@@ -17,13 +17,13 @@
setClass(
Class = "ref_dc",
representation = representation(
- dc_selectionne = "integer",
+ dc_selected = "integer",
ouvrage = "integer",
station = "character",
data = "data.frame"
),
prototype = prototype(
- dc_selectionne = integer(),
+ dc_selected = integer(),
ouvrage = integer(),
station = character(),
data = data.frame()
@@ -35,11 +35,11 @@
setValidity(
"ref_dc",
method = function(object) {
- if (length(object at dc_selectionne) != 0) {
+ if (length(object at dc_selected) != 0) {
if (nrow(object at data) > 0) {
- concord <- object at dc_selectionne %in% object at data$dc
+ concord <- object at dc_selected %in% object at data$dc
if (any(!concord)) {
- return(paste("No data for DC", object at dc_selectionne[!concord]))
+ return(paste("No data for DC", object at dc_selected[!concord]))
} else {
return(TRUE)
@@ -46,7 +46,7 @@
}
} else {
return(
- "You tried to set a value for dc_selectionne without initializing the data slot"
+ "You tried to set a value for dc_selected without initializing the data slot"
)
}
} else
@@ -81,22 +81,22 @@
" tdc_libelle as type_DC,",
"sta_code",
" FROM ",
- rlang::env_get(envir_stacomi, "sch"),
+ get_schema(),
"tg_dispositif_dis",
" JOIN ",
- rlang::env_get(envir_stacomi, "sch"),
+ get_schema(),
"t_dispositifcomptage_dic ON dic_dis_identifiant =dis_identifiant",
" JOIN ",
- rlang::env_get(envir_stacomi, "sch"),
+ get_schema(),
"t_dispositiffranchissement_dif ON dif_dis_identifiant=dic_dif_identifiant",
" JOIN ",
- rlang::env_get(envir_stacomi, "sch"),
+ get_schema(),
"tj_dfesttype_dft ON dif_dis_identifiant=dft_df_identifiant",
" JOIN ",
- rlang::env_get(envir_stacomi, "sch"),
+ get_schema(),
"t_ouvrage_ouv on dif_ouv_identifiant=ouv_identifiant",
" JOIN ",
- rlang::env_get(envir_stacomi, "sch"),
+ get_schema(),
"t_station_sta on ouv_sta_code=sta_code",
" JOIN ref.tr_typedf_tdf ON tdf_code=dft_tdf_code",
" JOIN ref.tr_typedc_tdc ON dic_tdc_code=tdc_code",
@@ -147,15 +147,15 @@
stop("NA values dc")
- object at dc_selectionne <- dc
+ object at dc_selected <- dc
validObject(object)
# the method validObject verifies that the dc is in the data slot of
# ref_dc
object at station <-
- as.character(object at data$sta_code[object at data$dc %in% object at dc_selectionne])
+ as.character(object at data$sta_code[object at data$dc %in% object at dc_selected])
object at ouvrage <-
- object at data$dif_ouv_identifiant[object at data$dc %in% object at dc_selectionne]
+ object at data$dif_ouv_identifiant[object at data$dc %in% object at dc_selected]
assign("ref_dc", object, envir = envir_stacomi)
return(object)
}
Modified: pkg/stacomir/R/ref_df.R
===================================================================
--- pkg/stacomir/R/ref_df.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/ref_df.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -3,28 +3,28 @@
#' Representation of a fishway, contains description data of all fishways from
#' the database along with the selected fishways (df) (integer)
#' Objects from the Class: Objects can be created by calls of the form
-#' \code{new('ref_df', df_selectionne=integer(), ouvrage=integer(),
+#' \code{new('ref_df', df_selected=integer(), ouvrage=integer(),
#' data=data.frame())}.
-#' @param df_selectionne Object of class \code{'integer'} The identifier of the fishway
+#' @param df_selected Object of class \code{'integer'} The identifier of the fishway
#' @param ouvrage Object of class \code{'integer'} The attached dam
#' @param data Object of class \code{'data.frame'} Data concerning the fishway
#' @author cedric.briand'at'eptb-vilaine.fr
#' @family referential objects
-setClass(Class = "ref_df", representation = representation(df_selectionne = "integer",
+setClass(Class = "ref_df", representation = representation(df_selected = "integer",
ouvrage = "integer", data = "data.frame"))
setValidity("ref_df", method = function(object) {
- if (length(object at df_selectionne) != 0) {
+ if (length(object at df_selected) != 0) {
if (nrow(object at data) > 0) {
- concord <- object at df_selectionne %in% object at data$df
+ concord <- object at df_selected %in% object at data$df
if (any(!concord)) {
- return(paste("No data for DF", object at df_selectionne[!concord]))
+ return(paste("No data for DF", object at df_selected[!concord]))
} else {
return(TRUE)
}
} else {
- return("You tried to set a value for df_selectionne without initializing the data slot")
+ return("You tried to set a value for df_selected without initializing the data slot")
}
} else return(TRUE)
@@ -43,10 +43,9 @@
requete at sql = paste("select dis_identifiant as DF,", " dis_date_creation,", " dis_date_suppression,",
" dis_commentaires,", " dif_ouv_identifiant,", " ouv_libelle,", " dif_code as DF_code,",
" dif_localisation,", " dif_orientation,", " tdf_libelle as type_DF", " from ",
- rlang::env_get(envir_stacomi, "sch"), "tg_dispositif_dis", " JOIN ", rlang::env_get(envir_stacomi,
- "sch"), "t_dispositiffranchissement_dif ON dif_dis_identifiant=dis_identifiant",
- " JOIN ", rlang::env_get(envir_stacomi, "sch"), "tj_dfesttype_dft ON dif_dis_identifiant=dft_df_identifiant",
- " JOIN ", rlang::env_get(envir_stacomi, "sch"), "t_ouvrage_ouv on dif_ouv_identifiant=ouv_identifiant",
+ get_schema(), "tg_dispositif_dis", " JOIN ", get_schema(), "t_dispositiffranchissement_dif ON dif_dis_identifiant=dis_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 ref.tr_typedf_tdf ON tdf_code=dft_tdf_code", " ORDER BY dis_identifiant;",
sep = "")
requete <- stacomirtools::query(requete)
@@ -86,8 +85,8 @@
}
if (any(is.na(df)))
stop("NA values df")
- object at df_selectionne <- df
- object at ouvrage = object at data$dif_ouv_identifiant[object at data$df %in% object at df_selectionne]
+ object at df_selected <- df
+ object at ouvrage = object at data$dif_ouv_identifiant[object at data$df %in% object at df_selected]
validObject(object)
# the method validObject verifies that the df is in the data slot of
# ref_df
Modified: pkg/stacomir/R/ref_env.R
===================================================================
--- pkg/stacomir/R/ref_env.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/ref_env.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -25,7 +25,7 @@
setMethod("charge", signature = signature("ref_env"), definition = function(object) {
requete = new("RequeteDB")
requete at sql = paste("SELECT stm_identifiant, stm_libelle, stm_sta_code, stm_par_code, stm_description",
- " FROM ", rlang::env_get(envir_stacomi, "sch"), "tj_stationmesure_stm", " ORDER BY stm_identifiant;",
+ " FROM ", get_schema(), "tj_stationmesure_stm", " ORDER BY stm_identifiant;",
sep = "")
requete at silent = TRUE
requete <- stacomirtools::query(requete)
Modified: pkg/stacomir/R/ref_horodate.R
===================================================================
--- pkg/stacomir/R/ref_horodate.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/ref_horodate.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -72,50 +72,8 @@
-
-#deprecated0.6
-##' Graphical interface
-##' @param object An object of class \link{ref_horodate-class}
-##' @param label Label for the gframe
-##' @param nomassign The name assigned in environment envir_stacomi
-##' @param funoutlabel, text displayed by the interface
-##' @param decal Default 0, number of years to shift forward or backward
-##' @keywords internal
-##' @return Selects the date in the graphical interface, and assigns an object of class POSIXt with name nomassign in envir_stacomi
-#setMethod("choice",signature=signature("ref_horodate"),definition=function(object,
-# label="date",
-# nomassign="horodate",
-# funoutlabel="nous avons le choix dans la date\n",
-# decal=0) {
-# hwinhor=function(h,...){
-# object=setref_horodate(object,svalue(horodate))
-# assign(nomassign,object at horodate,envir_stacomi)
-# funout(funoutlabel)
-# #print(object)
-# #dispose(winpa)
-# }
-# if (decal!=0){
-# # Returns the first horodate of a year shifted by decal
-# # @param horodate The horodate to shift (class POSIXt)
-# # @param decal number of year to shift
-# # @return A POSIXt
-# shiftyear<-function(horodate,decal){
-# anneeprec=as.numeric(strftime(horodate,"%Y"))+decal
-# return(strptime(paste(anneeprec,"-01-01",sep=""),format="%Y-%m-%d"))
-# }
-# object at horodate<-shiftyear(object at horodate,decal)
-# }
-# group<-get("group",envir=envir_stacomi)
-# winhor=gframe(label,container=group,horizontal=FALSE)
-# pg<-ggroup(horizontal=FALSE,container=winhor)
-# horodate<-gedit(getref_horodate(object),container=pg,handler=hwinhor,width=20)
-# horodate2=as.character(strftime(object at horodate,"%Y-%m-%d"))
-# gbutton("OK", container=winhor,handler=hwinhor,icon="execute")
-# })
-
-
-
-#' Command line
+#' Choice_c method for ref_horodate
+#' @aliases choice_c.ref_horodate
#' @param object An object of class \link{ref_horodate-class}
#' @param nomassign The name assigned in environment envir_stacomi
#' @param funoutlabel, text displayed by the interface
@@ -177,8 +135,7 @@
}
} else {
stop(
- "Formatting problem, the character vector you are trying to pass as horodate could not
- be parsed. Check example or documentation"
+ "Formatting problem, the character vector you are trying to pass as horodate could not be parsed. Check example or documentation"
)
}
@@ -189,8 +146,7 @@
}
if (is.na(.horodate))
stop(
- "Formatting problem, the character vector you are trying to pass as horodate could not
- be parsed. Check example or documentation"
+ "Formatting problem, the character vector you are trying to pass as horodate could not be parsed. Check example or documentation"
)
object at horodate = .horodate
validObject(object)
@@ -200,49 +156,3 @@
return(object)
}
)
-#deprecated0.6
-##' Multiple Choice method for ref_horodate referential objects, to put together with notebook widgets
-##' @param object An object of class \link{ref_horodate-class}
-##' @param label the name to write in the frame
-##' @param nomassign the name with which the frame will be assigned to envir_stacomi
-##' @param funoutlabel the sentence to write when the choice has been made
-##' @param decal Default year will be current year, use -1 to set the default value in the interface to the year before
-##' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
-##' @keywords internal
-#setMethod("choicemult",signature=signature("ref_horodate"),definition=function(object,
-# label="date",
-# nomassign="horodate",
-# funoutlabel="nous avons le choix dans la date\n",
-# decal=0
-# ) {
-# hhoro=function(h,...){
-# object=setref_horodate(object,svalue(horodate))
-# assign(nomassign,object at horodate,envir_stacomi)
-# funout(gettext("Horodate selected\n",domain="R-stacomiR"))
-# # changing tab of notebook to next tab
-# if (svalue(notebook)<length(notebook)){
-# svalue(notebook)<-svalue(notebook)+1
-# }
-# }
-# if (decal!=0){
-# # Returns the first horodate of a year shifted by decal
-# # @param horodate The horodate to shift (class POSIXt)
-# # @param decal number of year to shift
-# # @return A POSIXt
-# shiftyear<-function(horodate,decal){
-# anneeprec=as.numeric(strftime(horodate,"%Y"))+decal
-# return(strptime(paste(anneeprec,"-01-01",sep=""),format="%Y-%m-%d"))
-# }
-# object at horodate<-shiftyear(object at horodate,decal)
-# }
-#
-# if (!exists("notebook",envir_stacomi)){
-# group<-get("group",envir_stacomi)
-# notebook <- gnotebook(container=group)}
-# else {
-# notebook<-get("notebook",envir=envir_stacomi)
-# }
-# grouphorodate<-ggroup(container=notebook, label=label,horizontal=FALSE)
-# horodate<-gedit(getref_horodate(object),container=grouphorodate,handler=hhoro,width=20)
-# gbutton("OK", container=grouphorodate,handler=hhoro,icon="execute")
-# })
\ No newline at end of file
Modified: pkg/stacomir/R/ref_list.R
===================================================================
--- pkg/stacomir/R/ref_list.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/ref_list.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -1,10 +1,6 @@
-# Nom fichier : ref_list (classe) Description Classe permettant charger un
-# choice dans une liste utilisee par un objectreport
#' Class 'ref_list'
#'
#' Enables to load a 'ref_choice' object fom a list given by a 'report' object
-#'
-#'
#' @param liste choice='character' A vector of character to choose within a droplist
#' @param label='character' the title of the box
#' @section Objects from the Class: Objects can be created by calls of the form
@@ -19,7 +15,8 @@
selectedvalue = "character", label = "character"))
-#' Loading method for refliste referential objects
+#' Loading method for ref_list referential objects
+#' @aliases charge.ref_list
#' @return An object of class ref_list
#' @param object An object of class \link{ref_list-class}
#' @param listechoice A character vector setting the possible values in which the user can select
@@ -36,34 +33,10 @@
object at label = label
return(object)
})
-# deprecated0.6
-##' Choice method for ref_list referential objects
-##' @param object An object of class \link{ref_list-class}
-##' @param is.enabled A boolean indicating whether the frame is enabled when first displayed, default to TRUE
-##' @note the choice method assigns an object of class refList named ref_list in the environment envir_stacomi
-##' @author Cedric Briand \email{cedric.briand'at'eptb-vilaine.fr}
-##' @examples
-##' \dontrun{
-##' object=new('ref_list')
-##' win=gwindow()
-##' group=ggroup(container=win,horizontal=FALSE)
-##' object<-charge(object,vecteur=c('choice1','choice2'),label='please choose')
-##' choice(object)
-##' }
-##' @keywords internal
-# setMethod('choice',signature=signature('ref_list'),definition=function(object,is.enabled=TRUE)
-# { hlist=function(h,...){ valeurchoisie=svalue(choice)
-# object at selectedvalue<-object at listechoice[list_libelle%in%valeurchoisie]
-# assign('refliste',object,envir_stacomi)
-# funout(paste(object at label,'\n')) }
-# group<-get('group',envir=envir_stacomi) frame_list<<-gframe(object at label)
-# add(group,frame_list) list_libelle=fun_char_spe(object at listechoice)
-# choice=gdroplist(items=list_libelle,container=frame_list,handler=hlist)
-# enabled(frame_list)<-is.enabled gbutton('OK',
-# container=frame_list,handler=hlist) })
#' Choice_c method for ref_list referential objects
+#' @aliases choice_c.ref_list
#' @param object An object of class \link{ref_list-class}
#' @param selectedvalue the value selected in the combo
#' @note the choice method assigns an object of class refList named ref_list in the environment envir_stacomi
Modified: pkg/stacomir/R/ref_par.R
===================================================================
--- pkg/stacomir/R/ref_par.R 2021-11-15 11:03:09 UTC (rev 607)
+++ pkg/stacomir/R/ref_par.R 2021-11-16 09:32:32 UTC (rev 608)
@@ -29,7 +29,8 @@
} else return(TRUE)
})
-#' Loading method for Repar referential objects
+#' Loading method for ref_par referential objects
+#' @aliases charge.ref_par
#' @param object An object of class \link{ref_par-class}
#' @return An S4 object of class ref_par
#' @author Cedric Briand \email{cedric.briand'at'eptb-vilaine.fr}
@@ -46,31 +47,33 @@
object at data <- requete at query
return(object)
})
-#' Loading method for Repar referential objects searching only those parameters existing for a DC, a Taxa, and a stage
+
+
+#' Loading method for \code{ref_par referential} objects searching only those parameters existing for a DC, a Taxa, and a stage
+#' @aliases charge_with_filter.ref_par
#' @param object An object of class \link{ref_par-class}
-#' @param dc_selectionne A counting device selected for the report
-#' @param taxa_selectionne The taxa selected for the report
-#' @param stage_selectionne The stage selected for the report
+#' @param dc_selected A counting device selected for the report
+#' @param taxa_selected The taxa selected for the report
+#' @param stage_selected The stage selected for the report
#' @return An S4 object of class ref_par
#' @author Cedric Briand \email{cedric.briand'at'eptb-vilaine.fr}
#' @examples
#' \dontrun{
#' object=new('ref_par')
-#' charge_with_filter(object,dc_selectionne=6,taxa_selectionne=2038,stage_selectionne=c('AGJ','CIV')
+#' charge_with_filter(object,dc_selected=6,taxa_selected=2038,stage_selected=c('AGJ','CIV')
#' }
setMethod("charge_with_filter", signature = signature("ref_par"), definition = function(object,
- dc_selectionne, taxa_selectionne, stage_selectionne) {
+ dc_selected, taxa_selected, stage_selected) {
requete = new("RequeteDBwhere")
requete at select = paste("SELECT DISTINCT ON (par_code) par_code, par_nom", " FROM ",
- rlang::env_get(envir_stacomi, "sch"), "tg_dispositif_dis", " JOIN ", rlang::env_get(envir_stacomi,
- "sch"), "t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
- " JOIN ", rlang::env_get(envir_stacomi, "sch"), "t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
- " JOIN ", rlang::env_get(envir_stacomi, "sch"), "t_lot_lot on lot_ope_identifiant=ope_identifiant",
- " JOIN ", rlang::env_get(envir_stacomi, "sch"), "tj_caracteristiquelot_car on car_lot_identifiant=lot_identifiant",
+ get_schema(), "tg_dispositif_dis", " JOIN ", get_schema(), "t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
+ " JOIN ", get_schema(), "t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
+ " JOIN ", get_schema(), "t_lot_lot on lot_ope_identifiant=ope_identifiant",
+ " JOIN ", get_schema(), "tj_caracteristiquelot_car on car_lot_identifiant=lot_identifiant",
" JOIN ref.tg_parametre_par on par_code=car_par_code", sep = "")
- requete at where = paste("where dis_identifiant in ", vector_to_listsql(dc_selectionne))
- requete at and = paste("and lot_tax_code in", vector_to_listsql(taxa_selectionne),
- " and lot_std_code in ", vector_to_listsql(stage_selectionne), sep = "")
+ requete at where = paste("where dis_identifiant in ", vector_to_listsql(dc_selected))
+ requete at and = paste("and lot_tax_code in", vector_to_listsql(taxa_selected),
+ " and lot_std_code in ", vector_to_listsql(stage_selected), sep = "")
requete at order_by = "ORDER BY par_code"
requete <- stacomirtools::query(requete)
object at data <- requete at query
@@ -86,6 +89,7 @@
#' the choice_c method is intendedto have the same behaviour as choice (which creates a
#' widget in the graphical interface) but from the command line.
#' If an objectreport is passed as a parameter, the method will do a charge_with_filter to select only the taxa present in the counting devices.
+#' @aliases choice_c.ref_par
#' @param object an object of class \link{ref_par-class}
#' @param par A character vector of par
#' @param silent Default FALSE but not used there
@@ -117,78 +121,4 @@
})
-#' Multiple Choice method for ref_par referential objects, internal use
-#'
-#' @param object An object of class \link{ref_par-class}
-#' @param objectreport An object report which includes the \link{ref_par-class}, default NULL
-#' @param label The name for the frame
-#' @param nomassign The name by which the widget will be assigned in envir_stacomi
-#' @author Cedric Briand \email{cedric.briand'at'eptb-vilaine.fr}
-#' @examples
-#' \dontrun{
-#' object=new('ref_par')
-#' win=gwindow()
-#' group=ggroup(container=win,horizontal=FALSE)
-#' object<-charge(object)
-#' report_mig_char=new('report_mig_char')
-#' objectreport=report_taille # for other test
-#' choicemult(object,objectreport=report_mig_char)
-#' }
-#' @keywords internal
-# deprecated0.6
-# setMethod('choicemult',signature=signature('ref_par'),definition=function(object,
-# objectreport=NULL, label=gettext('Sample
-# characteristic',domain='R-stacomiR'), nomassign='ref_par') { if
-# (nrow(object at data) > 0){ hpar=function(h,...){
-# parm=tbdestpar[,][tbdestpar[,]!='']
-# object at par_selected<-object at data[car_libelle%in%parm,'par_code']
-# assign(nomassign,object,envir_stacomi) funout(gettext('Parameter
-# selected\n',domain='R-stacomiR')) if (!is.null(objectreport)) { #
-# the method can be used for parquan or par # so I test whether the
-# object contains a class parquan if
-# (class(try(objectreport at parquan,silent=TRUE))!='try-error') {
-# objectreport at parquan<-object
-# assign(get('objectreport',envir=envir_stacomi),objectreport,envir=envir_stacomi)
-# } else { objectreport at parm<-object
-# assign(get('objectreport',envir=envir_stacomi),objectreport,envir=envir_stacomi)
-# } # suppresses all tab larger than current tab
-# partab<-svalue(notebook) if (svalue(notebook)<length(notebook)){
-# svalue(notebook)<-partab+1 } } } # below the
-# widget structure [=> within (=> type #
-# group(ggroup)[notebook(notebook)[groupstd(ggroup&tab)[[framestdsource(gframe)[tbsourcestd(gtable)],framestddest(gframe)[tbdeststd(gtable)]],OKbutton]]
-# if (!exists('notebook',envir_stacomi)){
-# group<-get('group',envir_stacomi) notebook <-
-# gnotebook(container=group)} else {
-# notebook<-get('notebook',envir=envir_stacomi) }
-# car_libelle=fun_char_spe(object at data$par_nom)
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/stacomir -r 608
More information about the Stacomir-commits
mailing list