[Stacomir-commits] r291 - in pkg/stacomir: . inst/examples man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 12 20:05:34 CET 2017


Author: briand
Date: 2017-02-12 20:05:34 +0100 (Sun, 12 Feb 2017)
New Revision: 291

Added:
   pkg/stacomir/man/calcule-BilanMigrationInterAnnuelle-method.Rd
Modified:
   pkg/stacomir/NAMESPACE
   pkg/stacomir/inst/examples/bilanArgentee_example.R
   pkg/stacomir/man/BilanArgentee-class.Rd
   pkg/stacomir/man/BilanMigrationInterAnnuelle-class.Rd
   pkg/stacomir/man/charge-BilanMigrationInterAnnuelle-method.Rd
   pkg/stacomir/man/choice_c-RefAnnee-method.Rd
   pkg/stacomir/man/connect-BilanMigrationInterAnnuelle-method.Rd
   pkg/stacomir/man/envir_stacomi.Rd
   pkg/stacomir/man/funtraitementdate.Rd
   pkg/stacomir/man/plot-BilanMigrationInterAnnuelle-missing-method.Rd
   pkg/stacomir/man/write_database-BilanMigration-method.Rd
   pkg/stacomir/man/write_database-Bilan_poids_moyen-method.Rd
Log:


Modified: pkg/stacomir/NAMESPACE
===================================================================
--- pkg/stacomir/NAMESPACE	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/NAMESPACE	2017-02-12 19:05:34 UTC (rev 291)
@@ -53,6 +53,7 @@
 exportMethods(choice_c)
 exportMethods(connect)
 exportMethods(createmessage)
+exportMethods(getvalue)
 exportMethods(model)
 exportMethods(plot)
 exportMethods(print)
@@ -73,6 +74,8 @@
 import(stacomirtools)
 import(stringr)
 import(xtable)
+importFrom(Hmisc,capitalize)
+importFrom(Hmisc,wtd.quantile)
 importFrom(grDevices,adjustcolor)
 importFrom(grDevices,dev.new)
 importFrom(grDevices,gray)
@@ -106,6 +109,7 @@
 importFrom(lattice,trellis.par.set)
 importFrom(lubridate,"%m+%")
 importFrom(lubridate,floor_date)
+importFrom(lubridate,isoweek)
 importFrom(lubridate,round_date)
 importFrom(mgcv,gam)
 importFrom(reshape2,dcast)

Modified: pkg/stacomir/inst/examples/bilanArgentee_example.R
===================================================================
--- pkg/stacomir/inst/examples/bilanArgentee_example.R	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/inst/examples/bilanArgentee_example.R	2017-02-12 19:05:34 UTC (rev 291)
@@ -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{

Modified: pkg/stacomir/man/BilanArgentee-class.Rd
===================================================================
--- pkg/stacomir/man/BilanArgentee-class.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/BilanArgentee-class.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -46,7 +46,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{

Modified: pkg/stacomir/man/BilanMigrationInterAnnuelle-class.Rd
===================================================================
--- pkg/stacomir/man/BilanMigrationInterAnnuelle-class.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/BilanMigrationInterAnnuelle-class.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -53,7 +53,8 @@
 			anneedebut="1990",
 			anneefin="2015",
 			silent=FALSE)
-	bmi<-connect(bmi)	
+	bmi<-charge(bmi,silent=TRUE)
+	bmi<-connect(bmi,silent=TRUE)	
 }	
 # load the dataset generated by previous lines
 data("bmi")
@@ -125,7 +126,47 @@
 				ggplot2::ggtitle("Cumulated migration step plot at les Enfrenaux eel trap")
 		
 	}
-}		
+}	
+data("bmi_vichy")
+# statistics for seaonal migration, daily values
+bmi_vichy<-calcule(bmi_vichy,timesplit="jour")
+#bmi_vichy at calcdata #check this to see the results
+# statistics for seaonal migration, weekly values
+bmi_vichy<-calcule(bmi_vichy,timesplit="semaine")
+#bmi_vichy at calcdata
+
+
+# the plot method also runs calcule
+plot(bmi_vichy,plot.type="seasonal",timesplit="semaine")
+plot(bmi_vichy,plot.type="seasonal",timesplit="mois")
+plot(bmi_vichy,plot.type="seasonal",timesplit="jour")
+
+
+\dontrun{
+	# A test with lampreys in the Descarte DF (Vienne)
+	baseODBC<-get("baseODBC",envir=envir_stacomi)
+	baseODBC[c(2,3)]<-rep("logrami",2)
+	assign("baseODBC",baseODBC,envir_stacomi)
+	sch<-get("sch",envir=envir_stacomi)
+	assign("sch","logrami.",envir_stacomi)
+	bmi_des<-new("BilanMigrationInterAnnuelle") #descartes
+	bmi_des<-choice_c(bmi_des,
+			dc=c(23),
+			taxons=c("Petromyzon marinus"),
+			stades=c("5"),
+			anneedebut="2007",
+			anneefin="2014",
+			silent=FALSE)
+	bmi_des<-charge(bmi_des)
+	bmi_des<-connect(bmi_des)	
+	bmi_des<-calcule(bmi_des,timesplit="semaine")
+	plot(bmi_des,plot.type="seasonal",timesplit="semaine")
+	plot(bmi_des,plot.type="seasonal",timesplit="jour")
+	plot(bmi_des,plot.type="seasonal",timesplit="mois")
+}	
+
+
+
 }
 \author{
 Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}

Added: pkg/stacomir/man/calcule-BilanMigrationInterAnnuelle-method.Rd
===================================================================
--- pkg/stacomir/man/calcule-BilanMigrationInterAnnuelle-method.Rd	                        (rev 0)
+++ pkg/stacomir/man/calcule-BilanMigrationInterAnnuelle-method.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -0,0 +1,26 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/BilanMigrationInterAnnuelle.r
+\docType{methods}
+\name{calcule,BilanMigrationInterAnnuelle-method}
+\alias{calcule,BilanMigrationInterAnnuelle-method}
+\title{calcule method for BilanMigrationInterannuelle}
+\usage{
+\S4method{calcule}{BilanMigrationInterAnnuelle}(object, silent = FALSE,
+  timesplit = "mois")
+}
+\arguments{
+\item{object}{An object of class \code{\link{BilanMigrationInterannuelle-class}}}
+
+\item{silent}{Boolean, if TRUE, information messages are not displayed, only warnings and errors}
+}
+\value{
+BilanMigration with calcdata slot filled.
+}
+\description{
+calcule method for BilanMigrationInterannuelle
+}
+\note{
+The class BilanMigration does not handle escapement rates nor 
+'devenir' i.e. the destination of the fishes.
+}
+

Modified: pkg/stacomir/man/charge-BilanMigrationInterAnnuelle-method.Rd
===================================================================
--- pkg/stacomir/man/charge-BilanMigrationInterAnnuelle-method.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/charge-BilanMigrationInterAnnuelle-method.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -5,7 +5,7 @@
 \alias{charge,BilanMigrationInterAnnuelle-method}
 \title{loading method for BilanMigrationInterannuelle class}
 \usage{
-\S4method{charge}{BilanMigrationInterAnnuelle}(object, silent)
+\S4method{charge}{BilanMigrationInterAnnuelle}(object, silent = FALSE)
 }
 \arguments{
 \item{object}{An object of class \link{BilanMigrationInterAnnuelle-class}}

Modified: pkg/stacomir/man/choice_c-RefAnnee-method.Rd
===================================================================
--- pkg/stacomir/man/choice_c-RefAnnee-method.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/choice_c-RefAnnee-method.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -3,7 +3,7 @@
 \docType{methods}
 \name{choice_c,RefAnnee-method}
 \alias{choice_c,RefAnnee-method}
-\title{choice method for RefAnnee referential from the command line}
+\title{choice_c method for RefAnnee referential from the command line}
 \usage{
 \S4method{choice_c}{RefAnnee}(object, annee, nomassign = "refAnnee",
   funoutlabel = gettext("Year selected\\n", domain = "R-stacomiR"),
@@ -21,6 +21,7 @@
 \item{silent}{Stops messages from being displayed if silent=TRUE, default FALSE}
 }
 \description{
+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
 }
 \examples{

Modified: pkg/stacomir/man/connect-BilanMigrationInterAnnuelle-method.Rd
===================================================================
--- pkg/stacomir/man/connect-BilanMigrationInterAnnuelle-method.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/connect-BilanMigrationInterAnnuelle-method.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -5,19 +5,30 @@
 \alias{connect,BilanMigrationInterAnnuelle-method}
 \title{connect method for BilanMigrationInterannuelle class}
 \usage{
-\S4method{connect}{BilanMigrationInterAnnuelle}(object, silent = FALSE)
+\S4method{connect}{BilanMigrationInterAnnuelle}(object, silent = FALSE,
+  check = TRUE)
 }
 \arguments{
 \item{object}{An object of class \link{BilanMigrationInterAnnuelle-class}}
 
 \item{silent}{Stops messages from being displayed if silent=TRUE, default FALSE}
+
+\item{check}{Checks that data are corresponding between BilanAnnuels and BilanMigration}
 }
 \value{
 bilanMigrationInterAnnuelle an instantianted object with values filled with user choice
 }
 \description{
-connect method for BilanMigrationInterannuelle class
+This method will check if the data in the t_bilanjournalier_bjo table has no missing data,
+if missing the program will load missing data. As a second step,
+the program will check if the numbers in the table  t_bilanjournalier_bjo differ from those in the database,
+and propose to re-run the bilanmigration (which has a write_database methode to write daily bilans) for those years.
 }
+\note{
+We expect different results between daily bilans from the t_bilanjournalier_bjo table and the annual sums
+from bilanAnnuels for glass eels as those may have been weighted and not only counted. The t_bilanjournalier_bjo table used by BilanMigrationInterAnnuelle
+contains the sum of glass eel numbers converted from weights and those directly counted. The bilanAnnuels does not.
+}
 \author{
 Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 }

Modified: pkg/stacomir/man/envir_stacomi.Rd
===================================================================
--- pkg/stacomir/man/envir_stacomi.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/envir_stacomi.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -5,7 +5,7 @@
 \alias{envir_stacomi}
 \title{Environment where most objects from the package are stored and then loaded
 by the charge method}
-\format{An object of class \code{environment} of length 9.}
+\format{An object of class \code{environment} of length 4.}
 \usage{
 envir_stacomi
 

Modified: pkg/stacomir/man/funtraitementdate.Rd
===================================================================
--- pkg/stacomir/man/funtraitementdate.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/funtraitementdate.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -5,8 +5,8 @@
 \title{This function extracts temporal characteristics from a dataframe}
 \usage{
 funtraitementdate(data, nom_coldt, annee = TRUE, mois = TRUE,
-  quinzaine = FALSE, semaine = TRUE, jour_an = FALSE, jour_mois = TRUE,
-  heure = FALSE)
+  quinzaine = FALSE, semaine = TRUE, semaine_std = FALSE,
+  jour_an = FALSE, jour_mois = TRUE, heure = FALSE)
 }
 \arguments{
 \item{data}{a data frame containing a Date or POSIXt column}

Modified: pkg/stacomir/man/plot-BilanMigrationInterAnnuelle-missing-method.Rd
===================================================================
--- pkg/stacomir/man/plot-BilanMigrationInterAnnuelle-missing-method.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/plot-BilanMigrationInterAnnuelle-missing-method.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -29,10 +29,13 @@
         \item{plot.type="barchart": comparison of daily migration of one year against periodic migration for the other years available in the chronicle,
                                     different periods can be chosen with argument timesplit}
         \item{plot.type="pointrange": Pointrange graphs, different periods can be chosen with argument timesplit}
+     \item{plot.type="seasonal": plot to display summary statistics about the migration period}
 }}
 }
 \description{
-Plot method for BilanMigrationInterannuelle
+Several of these plots are scaled against the same year, ie the comparison is based on
+year 2000, meaning that day 1 would correspond to the first date of 2000,  which is also a
+saturday, the last day of the week.
 }
 \author{
 Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}

Modified: pkg/stacomir/man/write_database-BilanMigration-method.Rd
===================================================================
--- pkg/stacomir/man/write_database-BilanMigration-method.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/write_database-BilanMigration-method.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -7,7 +7,8 @@
 t_bilanmigrationjournalier_bjo table}
 \usage{
 \S4method{write_database}{BilanMigration}(object, silent = TRUE,
-  dbname = "bd_contmig_nat", host = "localhost", port = 5432)
+  dbname = "bd_contmig_nat", host = "localhost", port = 5432,
+  check_for_bjo = TRUE)
 }
 \arguments{
 \item{silent}{: TRUE to avoid messages}
@@ -18,6 +19,9 @@
 
 \item{port}{: the port, defaults to 5432}
 
+\item{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 BilanMigrationInterAnnuelle runs in loops}
+
 \item{bilanMigration}{an object of class \code{\linkS4class{BilanMigration}}}
 }
 \description{

Modified: pkg/stacomir/man/write_database-Bilan_poids_moyen-method.Rd
===================================================================
--- pkg/stacomir/man/write_database-Bilan_poids_moyen-method.Rd	2017-02-12 19:01:16 UTC (rev 290)
+++ pkg/stacomir/man/write_database-Bilan_poids_moyen-method.Rd	2017-02-12 19:05:34 UTC (rev 291)
@@ -5,7 +5,7 @@
 \alias{write_database,Bilan_poids_moyen-method}
 \title{Function to write data to the stacomi database for \link{Bilan_poids_moyen-class}}
 \usage{
-\S4method{write_database}{Bilan_poids_moyen}(object, silent,
+\S4method{write_database}{Bilan_poids_moyen}(object, silent = FALSE,
   dbname = "bd_contmig_nat", host = "localhost", port = 5432)
 }
 \arguments{
@@ -17,7 +17,8 @@
 An object of class \link{Bilan_poids_moyen-class}
 }
 \description{
-Function to write data to the stacomi database for \link{Bilan_poids_moyen-class}
+Data will be written in tj_coefficientconversion_coe table, if the class retrieves some data
+from the database, those will be deleted first.
 }
 \author{
 Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}



More information about the Stacomir-commits mailing list