[Stacomir-commits] r276 - in pkg/stacomir: R inst/examples inst/po/fr/LC_MESSAGES man po

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 2 22:02:22 CET 2017


Author: briand
Date: 2017-02-02 22:02:22 +0100 (Thu, 02 Feb 2017)
New Revision: 276

Added:
   pkg/stacomir/man/hreg.Rd
   pkg/stacomir/man/supprime-RefCoe-method.Rd
Modified:
   pkg/stacomir/R/Bilan_poids_moyen.r
   pkg/stacomir/R/RefCoe.r
   pkg/stacomir/R/data.r
   pkg/stacomir/inst/examples/bilanAgedemer_example.R
   pkg/stacomir/inst/examples/bilan_poids_moyen_example.R
   pkg/stacomir/inst/po/fr/LC_MESSAGES/R-stacomiR.mo
   pkg/stacomir/man/BilanAgedemer-class.Rd
   pkg/stacomir/man/Bilan_poids_moyen-class.Rd
   pkg/stacomir/man/bilPM.Rd
   pkg/stacomir/man/choice-RefAnnee-method.Rd
   pkg/stacomir/man/choice-RefStationMesure-method.Rd
   pkg/stacomir/man/choice-Refparqual-method.Rd
   pkg/stacomir/man/choice_c-RefAnnee-method.Rd
   pkg/stacomir/man/choice_c-RefStades-method.Rd
   pkg/stacomir/man/coef_Durif.Rd
   pkg/stacomir/po/R-stacomiR_fr_FR.mo
   pkg/stacomir/po/R-stacomiR_fr_FR.po
Log:
developed a method to delete coefficients from the database

Modified: pkg/stacomir/R/Bilan_poids_moyen.r
===================================================================
--- pkg/stacomir/R/Bilan_poids_moyen.r	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/R/Bilan_poids_moyen.r	2017-02-02 21:02:22 UTC (rev 276)
@@ -364,7 +364,7 @@
 				}
 				print(result)
 				p<-ggplot(don)+ geom_jitter(aes(x=doy,y=w),col="aquamarine4")+facet_wrap(~season )+
-						geom_line(aes(x=doy,y=pred_weight),data=predatafull)+
+						geom_line(aes(x=doy,y=pred_weight),data=predata)+
 						#geom_line(aes(x=doy,y=pred_weight),color="green",size=1,data=predatafull[predatafull$doy==50,])+
 						theme_minimal()+
 						theme(panel.border = element_blank(),
@@ -536,8 +536,9 @@
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @export
 setMethod("write_database",signature=signature("Bilan_poids_moyen"),definition=function(object,silent,dbname="bd_contmig_nat",host="localhost",port=5432){
-			object<-bilPM
+			bilPM<-object
 			if (!"import_coe"%in% names(bilPM at calcdata)) funout(gettext("Attention, you must fit a model before trying to write the predictions in the database",domain="R-stacomiR"),arret=TRUE)
+			supprime(bilPM,tax=2038,std="CIV")
 			import_coe<-bilPM at calcdata$import_coe
 			baseODBC<-get("baseODBC",envir=envir_stacomi)
 			sql<-stringr::str_c("INSERT INTO ",get("sch",envir=envir_stacomi),"tj_coefficientconversion_coe (",			
@@ -553,4 +554,7 @@
 									host=host,
 									port=port)
 					))		
-		})
\ No newline at end of file
+		})
+
+
+

Modified: pkg/stacomir/R/RefCoe.r
===================================================================
--- pkg/stacomir/R/RefCoe.r	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/R/RefCoe.r	2017-02-02 21:02:22 UTC (rev 276)
@@ -49,4 +49,33 @@
 			requete<-connect(requete)  
 			object at data<-requete at query
 			return(object)
-		})
\ No newline at end of file
+		})
+
+
+#' supprime method for "RefCoe" class
+#' @param object An object of class \link{RefCoe-class}
+#' @return nothing
+#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
+#' @export
+
+setMethod("supprime",signature=signature("RefCoe"),
+		definition=function(object,tax,std,silent=FALSE)
+		{ 
+			#object<-bilPM at coe;tax=2038;std="CIV"
+			# getting the data to import
+		
+			# here I assume that dc_selectionne will be unique (no bilan with several dc)
+			#
+			requete=new("RequeteODBCwheredate")
+			requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
+			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 ",get("sch",envir=envir_stacomi),"tj_coefficientconversion_coe ")
+			requete at and=" and  coe_tax_code='2038' and coe_std_code='CIV' and coe_qte_code='1'"
+			invisible(utils::capture.output(requete<-stacomirtools::connect(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/data.r
===================================================================
--- pkg/stacomir/R/data.r	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/R/data.r	2017-02-02 21:02:22 UTC (rev 276)
@@ -243,6 +243,7 @@
 "bilanArg"
 
 #' Silvering index coefficients from Caroline Durif (2009) to predict silvering stage from morphological parameters
+#' 
 #' Classification scores are calculated by multiplying the metrics 
 #' BL = body length, W = weight, MD = mean eye diameter (Dv+Dh)/2, and FL length of the pectoral fin,
 #' with each parameter p as S=Constant+BL*p(bl)+W*p(W)... The stage chosen is the one achieving the 
@@ -253,7 +254,9 @@
 #'  \url{http://fishlarvae.org/common/SiteMedia/durif\%20et\%20al\%202009b.pdf}
 "coef_Durif"
 
-#' Wet weight of glass eel from the trapping ladder. The years selected are 2009 to 2012,
+#' Wet weight of glass eel from the trapping ladder. 
+#' 
+#' The years selected are 2009 to 2012,
 #' the query used in the \link{Bilan_poids_moyen-class} loads from 2008-08-01 to 2012-08-01
 #' Glass eel are too numerous to be counted. They are weighted and in the stacomi database,
 #' a table with daily coefficients (in  N glass eel/g) to transform weight into number.

Modified: pkg/stacomir/inst/examples/bilanAgedemer_example.R
===================================================================
--- pkg/stacomir/inst/examples/bilanAgedemer_example.R	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/inst/examples/bilanAgedemer_example.R	2017-02-02 21:02:22 UTC (rev 276)
@@ -2,7 +2,7 @@
 # launching stacomi without selecting the scheme or interface
 stacomi(gr_interface=FALSE,
 		login_window=FALSE,
-		database_expected=TRUE)
+		database_expected=FALSE)
 # the following script will load data from the two Anguillere monitored in the Somme
 
 \dontrun{
@@ -31,14 +31,8 @@
 # stages are in bilan_adm at calcdata[["6"]][,"stage"] 
 #look at data structure using str(bilan_adm at calcdata[["6"]])
 
-# standard plot as drawn by Laurent Beaulaton (Analyse des données d'argenture acquises en France)
-# showing Durif's stage according to size and eye diameter
+# plot data to confirm the split by limits is correct
 plot(bilan_adm, plot.type=1)
 
-
 # print a summary statistic, and save the output in a list for later use
 stats<-summary(bilan_adm)
-
-object=new("RefMsg")
-msgfr<-charge_avec_filtre(object,lang='French')
-str(msgfr)
\ No newline at end of file

Modified: pkg/stacomir/inst/examples/bilan_poids_moyen_example.R
===================================================================
--- pkg/stacomir/inst/examples/bilan_poids_moyen_example.R	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/inst/examples/bilan_poids_moyen_example.R	2017-02-02 21:02:22 UTC (rev 276)
@@ -28,17 +28,14 @@
 # the calculation will fill the slot calcdata
 bilPM<-calcule(bilPM)
 
+# A ggplot showing the trend in weight
 plot(bilPM, plot.type=1)
-
-#
+# A plot showing both the data and the trend as recorded in the database
 plot(bilPM, plot.type=2)
-
-# plot showing fulton's coefficient, and size weight graphs
-# inspired from Acou et al., 2009 
-# Differential Production and Condition Indices of Premigrant
-# Eels in Two Small Atlantic Coastal Catchments
-# of France
+# 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(bilPM, plot.type=3)
-# get a list of summary data and print output to screen
 
-plot(bilPM, plot.type=4)
+# First model with nls, see Guerault and Desaunay (1993) 
+model(bilPM,model.type="seasonal")
+model(bilPM,model.type="seasonal1")
\ No newline at end of file

Modified: pkg/stacomir/inst/po/fr/LC_MESSAGES/R-stacomiR.mo
===================================================================
(Binary files differ)

Modified: pkg/stacomir/man/BilanAgedemer-class.Rd
===================================================================
--- pkg/stacomir/man/BilanAgedemer-class.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/BilanAgedemer-class.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -48,7 +48,7 @@
 # launching stacomi without selecting the scheme or interface
 stacomi(gr_interface=FALSE,
 		login_window=FALSE,
-		database_expected=TRUE)
+		database_expected=FALSE)
 # the following script will load data from the two Anguillere monitored in the Somme
 
 \dontrun{
@@ -77,17 +77,11 @@
 # stages are in bilan_adm at calcdata[["6"]][,"stage"] 
 #look at data structure using str(bilan_adm at calcdata[["6"]])
 
-# standard plot as drawn by Laurent Beaulaton (Analyse des données d'argenture acquises en France)
-# showing Durif's stage according to size and eye diameter
+# plot data to confirm the split by limits is correct
 plot(bilan_adm, plot.type=1)
 
-
 # print a summary statistic, and save the output in a list for later use
 stats<-summary(bilan_adm)
-
-object=new("RefMsg")
-msgfr<-charge_avec_filtre(object,lang='French')
-str(msgfr)
 }
 \author{
 Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}

Modified: pkg/stacomir/man/Bilan_poids_moyen-class.Rd
===================================================================
--- pkg/stacomir/man/Bilan_poids_moyen-class.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/Bilan_poids_moyen-class.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -37,11 +37,48 @@
 request are from august to august (a glass eel season)
 }
 \examples{
- \dontrun{
-showClass("Bilan_poids_moyen")
-object=new("Bilan_poids_moyen")
+require(stacomiR)
+# launching stacomi without selecting the scheme or interface
+stacomi(gr_interface=FALSE,
+		login_window=FALSE,
+		database_expected=TRUE)
+# the following script will load data from the two Anguillere monitored in the Somme
+
+\dontrun{
+	#create an instance of the class
+	bilPM<-new("Bilan_poids_moyen")
+	baseODBC<-get("baseODBC",envir=envir_stacomi)
+	baseODBC[c(2,3)]<-rep("iav",2)
+	assign("baseODBC",baseODBC,envir_stacomi)
+	sch<-get("sch",envir=envir_stacomi)
+	assign("sch","iav.",envir_stacomi)
+	bilPM at liste<-charge(object=bilPM at liste,listechoice=c("=1",">1","tous"),label="")
+	# here I'm using weights when number are larger than 1 ie wet weight
+	bilPM<-choice_c(bilPM,
+			dc=c(6),			
+			anneedebut="2009",
+			anneefin="2015",
+			selectedvalue=">1",
+			silent=FALSE)
+	bilPM<-connect(bilPM)	
+}	
+# load the dataset generated by previous lines
+data("bilPM")
+# the calculation will fill the slot calcdata
+bilPM<-calcule(bilPM)
+
+# A ggplot showing the trend in weight
+plot(bilPM, plot.type=1)
+# A plot showing both the data and the trend as recorded in the database
+plot(bilPM, 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(bilPM, plot.type=3)
+
+# First model with nls, see Guerault and Desaunay (1993) 
+model(bilPM,model.type="seasonal")
+model(bilPM,model.type="seasonal1")
 }
-}
 \author{
 Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 }

Modified: pkg/stacomir/man/bilPM.Rd
===================================================================
--- pkg/stacomir/man/bilPM.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/bilPM.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -3,19 +3,13 @@
 \docType{data}
 \name{bilPM}
 \alias{bilPM}
-\title{Wet weight of glass eel from the trapping ladder. The years selected are 2009 to 2012,
-the query used in the \link{Bilan_poids_moyen-class} loads from 2008-08-01 to 2012-08-01
-Glass eel are too numerous to be counted. They are weighted and in the stacomi database,
-a table with daily coefficients (in  N glass eel/g) to transform weight into number.
-The weight is called a "wet weight" as we don't wan't to drain any of the mucus in glass eel
-when weighting them. Samples of 50 to 200 glass eel are weighted and then counted to provide an idea of
-the seasonal evolution of wet weight.}
+\title{Wet weight of glass eel from the trapping ladder.}
 \format{An object of class \code{Bilan_poids_moyen} of length 1.}
 \usage{
 bilPM
 }
 \description{
-Wet weight of glass eel from the trapping ladder. The years selected are 2009 to 2012,
+The years selected are 2009 to 2012,
 the query used in the \link{Bilan_poids_moyen-class} loads from 2008-08-01 to 2012-08-01
 Glass eel are too numerous to be counted. They are weighted and in the stacomi database,
 a table with daily coefficients (in  N glass eel/g) to transform weight into number.

Modified: pkg/stacomir/man/choice-RefAnnee-method.Rd
===================================================================
--- pkg/stacomir/man/choice-RefAnnee-method.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/choice-RefAnnee-method.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -6,8 +6,8 @@
 \title{choice method for RefAnnee referential}
 \usage{
 \S4method{choice}{RefAnnee}(object, nomassign = "refAnnee",
-  funoutlabel = gettext("Year selected\\n"),
-  titleFrame = gettext("Year choice"), preselect = 1)
+  funoutlabel = gettext("Year selected\\n", domain = "R-stacomiR"),
+  titleFrame = gettext("Year choice", domain = "R-stacomiR"), preselect = 1)
 }
 \arguments{
 \item{object}{An object of class \link{RefAnnee-class}}

Modified: pkg/stacomir/man/choice-RefStationMesure-method.Rd
===================================================================
--- pkg/stacomir/man/choice-RefStationMesure-method.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/choice-RefStationMesure-method.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -6,7 +6,7 @@
 \title{Choice method for RefStationMesure referential object}
 \usage{
 \S4method{choice}{RefStationMesure}(object, is.enabled = TRUE,
-  title = gettext("Monitoring stations selection"))
+  title = gettext("Monitoring stations selection", domain = "R-stacomiR"))
 }
 \arguments{
 \item{object}{An object of class \link{RefStationMesure-class}}

Modified: pkg/stacomir/man/choice-Refparqual-method.Rd
===================================================================
--- pkg/stacomir/man/choice-Refparqual-method.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/choice-Refparqual-method.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -6,7 +6,7 @@
 \title{Choice method for Refparqual referential objects, internal use}
 \usage{
 \S4method{choice}{Refparqual}(object,
-  label = "Choix d'une caracteristique qualitative de lot",
+  label = gettext("Choice of a sample characteristic", domain = "R-stacomiR"),
   nomassign = "refpar", frameassign = "frame_par", is.enabled = TRUE)
 }
 \arguments{

Modified: pkg/stacomir/man/choice_c-RefAnnee-method.Rd
===================================================================
--- pkg/stacomir/man/choice_c-RefAnnee-method.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/choice_c-RefAnnee-method.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -6,7 +6,8 @@
 \title{choice method for RefAnnee referential from the command line}
 \usage{
 \S4method{choice_c}{RefAnnee}(object, annee, nomassign = "refAnnee",
-  funoutlabel = gettext("Year selected\\n"), silent = FALSE)
+  funoutlabel = gettext("Year selected\\n", domain = "R-stacomiR"),
+  silent = FALSE)
 }
 \arguments{
 \item{object}{An object of class \link{RefAnnee-class}}

Modified: pkg/stacomir/man/choice_c-RefStades-method.Rd
===================================================================
--- pkg/stacomir/man/choice_c-RefStades-method.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/choice_c-RefStades-method.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -5,7 +5,7 @@
 \alias{choice_c,RefStades-method}
 \title{choice_c method for RefStades}
 \usage{
-\S4method{choice_c}{RefStades}(object, stades)
+\S4method{choice_c}{RefStades}(object, stades, silent = FALSE)
 }
 \arguments{
 \item{object}{An object of class \link{RefStades-class}}

Modified: pkg/stacomir/man/coef_Durif.Rd
===================================================================
--- pkg/stacomir/man/coef_Durif.Rd	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/man/coef_Durif.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -3,17 +3,12 @@
 \docType{data}
 \name{coef_Durif}
 \alias{coef_Durif}
-\title{Silvering index coefficients from Caroline Durif (2009) to predict silvering stage from morphological parameters
-Classification scores are calculated by multiplying the metrics 
-BL = body length, W = weight, MD = mean eye diameter (Dv+Dh)/2, and FL length of the pectoral fin,
-with each parameter p as S=Constant+BL*p(bl)+W*p(W)... The stage chosen is the one achieving the 
-highest score}
+\title{Silvering index coefficients from Caroline Durif (2009) to predict silvering stage from morphological parameters}
 \format{An object of class \code{matrix} with 5 rows and 6 columns.}
 \usage{
 coef_Durif
 }
 \description{
-Silvering index coefficients from Caroline Durif (2009) to predict silvering stage from morphological parameters
 Classification scores are calculated by multiplying the metrics 
 BL = body length, W = weight, MD = mean eye diameter (Dv+Dh)/2, and FL length of the pectoral fin,
 with each parameter p as S=Constant+BL*p(bl)+W*p(W)... The stage chosen is the one achieving the 

Added: pkg/stacomir/man/hreg.Rd
===================================================================
--- pkg/stacomir/man/hreg.Rd	                        (rev 0)
+++ pkg/stacomir/man/hreg.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/Bilan_poids_moyen.r
+\name{hreg}
+\alias{hreg}
+\title{Internal handler for reg, class \code{\link{Bilan_poids_moyen-class}}.}
+\usage{
+hreg(h, ...)
+}
+\arguments{
+\item{h}{handler}
+
+\item{\dots}{additional arguments passed to the function}
+}
+\description{
+Internal handler for reg, class \code{\link{Bilan_poids_moyen-class}}.
+}
+

Added: pkg/stacomir/man/supprime-RefCoe-method.Rd
===================================================================
--- pkg/stacomir/man/supprime-RefCoe-method.Rd	                        (rev 0)
+++ pkg/stacomir/man/supprime-RefCoe-method.Rd	2017-02-02 21:02:22 UTC (rev 276)
@@ -0,0 +1,22 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/RefCoe.r
+\docType{methods}
+\name{supprime,RefCoe-method}
+\alias{supprime,RefCoe-method}
+\title{supprime method for "RefCoe" class}
+\usage{
+\S4method{supprime}{RefCoe}(object, tax, std, silent = FALSE)
+}
+\arguments{
+\item{object}{An object of class \link{RefCoe-class}}
+}
+\value{
+nothing
+}
+\description{
+supprime method for "RefCoe" class
+}
+\author{
+Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
+}
+

Modified: pkg/stacomir/po/R-stacomiR_fr_FR.mo
===================================================================
(Binary files differ)

Modified: pkg/stacomir/po/R-stacomiR_fr_FR.po
===================================================================
--- pkg/stacomir/po/R-stacomiR_fr_FR.po	2017-02-02 12:09:10 UTC (rev 275)
+++ pkg/stacomir/po/R-stacomiR_fr_FR.po	2017-02-02 21:02:22 UTC (rev 276)
@@ -2,7 +2,7 @@
 msgstr ""
 "Project-Id-Version: stacomiR 0.5.0\n"
 "POT-Creation-Date: 2017-02-02 12:54+0100\n"
-"PO-Revision-Date: 2017-02-02 13:06+0100\n"
+"PO-Revision-Date: 2017-02-02 13:21+0100\n"
 "Last-Translator: \n"
 "Language-Team: \n"
 "Language: fr_FR\n"
@@ -1542,7 +1542,7 @@
 msgstr "Station"
 
 msgid "Counting Device"
-msgstr "Dispositif de Franchissement"
+msgstr "Dispositif de Comptage"
 
 msgid "Operation (TODO)"
 msgstr "Opération (TODO)"



More information about the Stacomir-commits mailing list