[Stacomir-commits] r214 - in pkg/stacomir: . R inst inst/examples inst/examples/01_BilanMigrationMult inst/tests/testthat man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 23 21:32:44 CEST 2016


Author: briand
Date: 2016-09-23 21:32:43 +0200 (Fri, 23 Sep 2016)
New Revision: 214

Added:
   pkg/stacomir/inst/examples/
   pkg/stacomir/inst/examples/bilanFonctionnementDF_example.R
   pkg/stacomir/inst/examples/bilanMigrationMult_Arzal.R
   pkg/stacomir/inst/examples/bilanMigration_Arzal.R
   pkg/stacomir/man/funbarchart1DF.Rd
   pkg/stacomir/man/funchartDF.Rd
   pkg/stacomir/man/houtDF.Rd
   pkg/stacomir/man/print-BilanFonctionnementDF-method.Rd
   pkg/stacomir/man/split_per_day.Rd
   pkg/stacomir/man/summary-BilanFonctionnementDF-method.Rd
Removed:
   pkg/stacomir/examples/
   pkg/stacomir/inst/examples/00_BilanMigration/
   pkg/stacomir/inst/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R
Modified:
   pkg/stacomir/NAMESPACE
   pkg/stacomir/R/BilanFonctionnementDC.r
   pkg/stacomir/R/BilanFonctionnementDF.r
   pkg/stacomir/R/BilanMigration.r
   pkg/stacomir/R/BilanMigrationConditionEnv.r
   pkg/stacomir/R/BilanMigrationInterAnnuelle.r
   pkg/stacomir/R/BilanMigrationMult.r
   pkg/stacomir/R/BilanMigrationPar.r
   pkg/stacomir/R/Bilan_poids_moyen.r
   pkg/stacomir/R/Bilan_stades_pigm.r
   pkg/stacomir/R/RefCheckBox.r
   pkg/stacomir/R/RefChoix.r
   pkg/stacomir/R/RefCoe.r
   pkg/stacomir/R/fn_EcritBilanJournalier.r
   pkg/stacomir/R/fn_EcritBilanMensuel.r
   pkg/stacomir/R/funSousListeBilanMigrationPar.r
   pkg/stacomir/R/interface_BilanFonctionnementDF.r
   pkg/stacomir/R/stacomi.r
   pkg/stacomir/R/utilitaires.r
   pkg/stacomir/inst/tests/testthat/test-00stacomir.R
   pkg/stacomir/man/BilanFonctionnementDF-class.Rd
   pkg/stacomir/man/Bilan_stades_pigm-class.Rd
   pkg/stacomir/man/calcule-BilanMigrationConditionEnv-method.Rd
   pkg/stacomir/man/charge-BilanFonctionnementDC-method.Rd
   pkg/stacomir/man/charge-BilanMigration-method.Rd
   pkg/stacomir/man/charge-BilanMigrationMult-method.Rd
   pkg/stacomir/man/charge-Bilan_poids_moyen-method.Rd
   pkg/stacomir/man/charge-RefCheckBox-method.Rd
   pkg/stacomir/man/charge-RefChoix-method.Rd
   pkg/stacomir/man/charge-RefCoe-method.Rd
   pkg/stacomir/man/fnstade.Rd
   pkg/stacomir/man/funbarchartDF.Rd
   pkg/stacomir/man/funboxDF.Rd
   pkg/stacomir/man/fundist.Rd
   pkg/stacomir/man/funtableDF.Rd
   pkg/stacomir/man/msg.Rd
   pkg/stacomir/man/summary-BilanMigrationMult-method.Rd
Log:


Modified: pkg/stacomir/NAMESPACE
===================================================================
--- pkg/stacomir/NAMESPACE	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/NAMESPACE	2016-09-23 19:32:43 UTC (rev 214)
@@ -7,15 +7,12 @@
 export(fun_bilanMigrationMult)
 export(fun_bilanMigrationMult_Overlaps)
 export(fun_char_spe)
-export(funbarchartDF)
-export(funboxDF)
 export(funboxplotBilan_carlot)
 export(fundensityBilan_carlot)
 export(funout)
 export(funpointBilan_carlot)
 export(funstat)
 export(funtableBilan_carlot)
-export(funtableDF)
 export(funtraitement_poids)
 export(hBilanEspecescalc)
 export(hCamembert)
@@ -24,6 +21,7 @@
 export(interface_BilanEspeces)
 export(messages)
 export(mygtkProgressBar)
+export(split_per_day)
 export(stacomi)
 export(vector_to_listsql)
 exportClasses(BilanConditionEnv)
@@ -49,7 +47,6 @@
 exportMethods(print)
 exportMethods(summary)
 exportMethods(supprime)
-import(Hmisc)
 import(RColorBrewer)
 import(RGtk2)
 import(RODBC)

Modified: pkg/stacomir/R/BilanFonctionnementDC.r
===================================================================
--- pkg/stacomir/R/BilanFonctionnementDC.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/BilanFonctionnementDC.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -72,7 +72,6 @@
 #' used by the graphical interface to retreive the objects of Referential classes
 #' assigned to envir_stacomi
 #' @param object An object of class \link{BilanFonctionnementDC-class}
-#' @param h A handler passed from the graphical interface
 #' @return  An object of class \link{BilanFonctionnementDC-class}
 #' 
 #' @author cedric.briand

Modified: pkg/stacomir/R/BilanFonctionnementDF.r
===================================================================
--- pkg/stacomir/R/BilanFonctionnementDF.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/BilanFonctionnementDF.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -25,7 +25,7 @@
 #' \code{\linkS4class{BilanMigrationInterAnnuelle}}
 #' \code{\linkS4class{BilanMigrationPar}}
 #' @concept Bilan Object 
-#' @examples examples/03_BilanFonctionnementDF/bilanFonctionnementDF_example.R
+#' @examples inst/examples/bilanFonctionnementDF_example.R
 #' @export 
 setClass(Class="BilanFonctionnementDF",
 		representation= representation(data="data.frame",
@@ -281,7 +281,7 @@
 				mypalette1<-c("#1B9E77","#AE017E","orange", RColorBrewer::brewer.pal(12,"Paired"))
 				# creation d'un graphique vide
 				if (is.null(title)) title<-""
-				plot(   graphdate(time.sequence),
+				plot(graphdate(time.sequence),
 						seq(0,1,length.out=length(time.sequence)),
 						xlim=c(debut,fin), 
 						type= "n", 

Modified: pkg/stacomir/R/BilanMigration.r
===================================================================
--- pkg/stacomir/R/BilanMigration.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/BilanMigration.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -26,7 +26,7 @@
 #' \code{\linkS4class{BilanMigrationInterAnnuelle}}, 
 #' \code{\linkS4class{BilanMigrationPar}}
 #' @concept Bilan Object 
-#' @example examples/02_BilanMigration/bilanMigration_Arzal.R
+#' @example inst/examples/bilanMigration_Arzal.R
 #' @export 
 setClass(Class="BilanMigration",
 		representation=
@@ -128,6 +128,7 @@
 #' 
 #' fills also the data slot by the connect method
 #' @param object An object of class \code{\link{BilanMigration-class}}
+#' @param silent Should the program be returning messages
 #' @return An object of class \link{BilanMigration-class} with slots filled by user choice
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @export
@@ -325,9 +326,9 @@
 			} else {      
 				funout(get("msg",envir_stacomi)$BilanMigration.5,arret=TRUE)
 			}
-			#§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
+			################################################################
 			#                 standard plot
-			#§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
+			################################################################
 			if (plot.type=="standard"){
 				if (!silent) print("plot type standard")
 				if (!silent) funout(get("msg",envir_stacomi)$BilanMigration.9)				
@@ -394,9 +395,9 @@
 					if (database_expected) fn_EcritBilanJournalier(bilanMigration,silent)
 				} # end is.null(data)
 				
-				#§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
+				################################################################
 				#                 step plot
-				#§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§
+				################################################################
 			} else if (plot.type=="step"){
 				taxon= as.character(bilanMigration at taxons@data$tax_nom_latin)
 				stade= as.character(bilanMigration at stades@data$std_libelle)

Modified: pkg/stacomir/R/BilanMigrationConditionEnv.r
===================================================================
--- pkg/stacomir/R/BilanMigrationConditionEnv.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/BilanMigrationConditionEnv.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -70,7 +70,7 @@
 
 #' @param object An object of class \code{\link{BilanMigrationConditionEnv-class}}
 #' @param ... additional parameters
-#' @return \code{\link{BilanMigrationEnv-class}}
+#' @return \code{\link{BilanMigrationConditionEnv-class}}
 #' @export
 setMethod("calcule",signature=signature("BilanMigrationConditionEnv"),definition=function(object,...){ 
 			# le chargement de bilanMigration utilise la methode calcule de BilanMigration

Modified: pkg/stacomir/R/BilanMigrationInterAnnuelle.r
===================================================================
--- pkg/stacomir/R/BilanMigrationInterAnnuelle.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/BilanMigrationInterAnnuelle.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -119,7 +119,7 @@
 			requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
 			requete at select=stringr::str_c("DELETE from ",get("sch",envir=envir_stacomi),"t_bilanmigrationmensuel_bme ")
 			requete at where=paste("WHERE bme_annee IN (",paste(les_annees,collapse=","),") AND bme_tax_code='",tax,"' AND bme_std_code='",std,"' AND bme_dis_identifiant=",dic,sep="")
-			invisible(capture_output(requete<-stacomirtools::connect(requete)))
+			invisible(utils::capture.output(requete<-stacomirtools::connect(requete)))
 			
 			return(invisible(NULL))
 		}

Modified: pkg/stacomir/R/BilanMigrationMult.r
===================================================================
--- pkg/stacomir/R/BilanMigrationMult.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/BilanMigrationMult.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -25,7 +25,7 @@
 #' method if any weight are found in the data slot.
 #' @slot time.sequence A POSIXt time sequence
 #' @export
-#' @example examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R
+#' @example inst/examples/bilanMigrationMult_Arzal.R
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 setClass(Class="BilanMigrationMult",
 		representation=
@@ -64,9 +64,11 @@
 #' 
 #' Used by the graphical interface to collect and test objects in the environment envir_stacomi, 
 #' fills also the data slot by the connect method
+#' @param object An object of class \link{BilanMigrationMult-class}
+#' @param silent Default FALSE, if TRUE the program should no display messages
 #' @return BilanMigrationMult with slots filled by user choice
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
-setMethod("charge",signature=signature("BilanMigrationMult"),definition=function(object,...){ 
+setMethod("charge",signature=signature("BilanMigrationMult"),definition=function(object,silent=FALSE){ 
 			bilanMigrationMult<-object
 			if (exists("refDC",envir_stacomi)) {
 				bilanMigrationMult at dc<-get("refDC",envir_stacomi)

Modified: pkg/stacomir/R/BilanMigrationPar.r
===================================================================
--- pkg/stacomir/R/BilanMigrationPar.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/BilanMigrationPar.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -129,9 +129,6 @@
 			
 			stopifnot(validObject(bilanMigrationPar, test=TRUE))
 			funout(get("msg",envir=envir_stacomi)$BilanMigrationPar.1)
-			# save(bilanMigrationPar,file="EXAMPLES/devt.Rdata")
-			#undebug(funSousListeBilanMigrationPar)
-			# debug(funSousListeBilanMigrationPar)
 			if (bilanMigrationPar at parquan@data$par_nom=="aucune" & bilanMigrationPar at parqual@data$par_nom=="aucune") {
 				funout(get("msg",envir=envir_stacomi)$BilanMigrationPar.2,arret=TRUE)}
 			res<-funSousListeBilanMigrationPar(bilanMigrationPar=bilanMigrationPar)

Modified: pkg/stacomir/R/Bilan_poids_moyen.r
===================================================================
--- pkg/stacomir/R/Bilan_poids_moyen.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/Bilan_poids_moyen.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -100,11 +100,11 @@
 # Cette methode permet de verifier que les boites ont ete cliquees et va chercher les
 # objects qui sont colles dans l'environnement envir_stacomi de l'interface 
 #' charge method for Bilan_poids_moyen class
-#' @param h a handler 
+#' @param object An object of class \link{Bilan_poids_moyen-class}
 #' @return Bilan_poids_moyen with slots filled with user choice
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @export
-setMethod("charge",signature=signature("Bilan_poids_moyen"),definition=function(object,h) {
+setMethod("charge",signature=signature("Bilan_poids_moyen"),definition=function(object) {
 			if (exists("refliste",envir_stacomi)) {      
 				object at liste<-get("refliste",envir_stacomi)      
 			} else {      

Modified: pkg/stacomir/R/Bilan_stades_pigm.r
===================================================================
--- pkg/stacomir/R/Bilan_stades_pigm.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/Bilan_stades_pigm.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -53,7 +53,7 @@
 #' glass eel Anguilla anguilla pigmentation development. J Fish Biol, 67,
 #' 995-1009.
 #' \url{http://www3.interscience.wiley.com/journal/118686679/abstract}
-#' \url{http://www.eptb-vilaine.fr/site/index.php/publications-scientifiques/46-publications-migrateurs/60-dynamique-de-population-et-de-migration-des-civelles-en-estuaire-de-vilaine.}
+#' \url{http://www.eptb-vilaine.fr/site/index.php/les-migrateurs/documents/publications-scientifiques/46-publications-migrateurs/60-dynamique-de-population-et-de-migration-des-civelles-en-estuaire-de-vilaine}
 #' @examples
 #' #' showClass("Bilan_stades_pigm")
 #' @export 
@@ -351,7 +351,7 @@
 #' glass eel Anguilla anguilla pigmentation development. J Fish Biol, 67,
 #' 995-1009.
 #' \url{http://www3.interscience.wiley.com/journal/118686679/abstract}
-#' \url{http://www.eptb-vilaine.fr/site/index.php/publications-scientifiques/46-publications-migrateurs/60-dynamique-de-population-et-de-migration-des-civelles-en-estuaire-de-vilaine.}
+#' \url{http://www.eptb-vilaine.fr/site/index.php/les-migrateurs/documents/publications-scientifiques/46-publications-migrateurs/60-dynamique-de-population-et-de-migration-des-civelles-en-estuaire-de-vilaine}
 fnstade<-function(par1, par2=NULL,phicum,phidates,VB=FALSE,neg=TRUE,lmax=1){
 	if (neg){
 		phidates=as.numeric(as.POSIXct(strptime(phidates,format="%Y-%m-%d")))
@@ -426,8 +426,9 @@
 #' @examples
 #'  \dontrun{
 #' Vparm<-list()
-#' # below param for briand et al.,2005 pigmentation function in glass eel
-#' Vparm$pigment_stage$p1<-0.267 # parameters for gamma functions describing changes from stage to stage
+#' #below param for briand et al.,2005 pigmentation function in glass eel
+#' #parameters for gamma functions describing changes from stage to stage
+#' Vparm$pigment_stage$p1<-0.267 
 #' Vparm$pigment_stage$p2<-0.835
 #' Vparm$pigment_stage$p3<-1.56
 #' Vparm$pigment_stage$p4<-3.682
@@ -441,8 +442,10 @@
 #' fundist(Vparm,seq(0,10, length.out=10000),graph=FALSE,lmax=1)
 #' fundist(Vparm,seq(0,10, length.out=10000),graph=TRUE,lmax=1)
 #' fundist(Vparm,seq(0,10, length.out=10000),graph=TRUE,lmax=0)
-#' plot(seq(0,10, length.out=10000),pgamma(seq(0,10, length.out=10000),Vparm$pigment_stage[[1]]),col="pink")
-#' points(seq(0,10, length.out=10000),pgamma(seq(0,10, length.out=10000),Vparm$pigment_stage[[2]]),col="firebrick") 
+#' plot(seq(0,10, length.out=10000),pgamma(seq(0,10, length.out=10000),
+#' Vparm$pigment_stage[[1]]),col="pink")
+#' points(seq(0,10, length.out=10000),pgamma(seq(0,10, length.out=10000),
+#' Vparm$pigment_stage[[2]]),col="firebrick") 
 #' }
 fundist=function(Vparm, phicum,graph=TRUE,lmax=1){
 	VB=fnstade(par1=Vparm$pigment_stage[[1]],VB=TRUE,phicum=phicum,neg=FALSE,lmax=lmax)
@@ -738,7 +741,7 @@
 	}
 	if (graphstades)  {
 		# stades cumules calcul necessaire pour points et graphique time.sequences
-		# le graphique ne supporte pas plusieurs echantillons a la même date d'ou le choice
+		# le graphique ne supporte pas plusieurs echantillons a la meme date d'ou le choice
 		
 	graphics::par("mar"=c(2, 4, 3, 2)+ 0.1)
 		surface(dates,tablestades,couleur=grDevices::gray(5:1/6),ordre=c(1,2,3,4,5),

Modified: pkg/stacomir/R/RefCheckBox.r
===================================================================
--- pkg/stacomir/R/RefCheckBox.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/RefCheckBox.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -28,7 +28,11 @@
 		prototype=prototype(title="liste de choice",labels="choice",checked=FALSE))
 
 #' Loading method for ReCheckBox referential objects
-#' @return An S4 object of class RefCheckBox
+#' @param object An object of class \link{ReCheckBox-class}
+#' @param title Title of the frame
+#' @param labels Labels for checked
+#' @param checked Vector of boolean indicating if refCheckBox are checked
+#' @return An object of class \link{ReCheckBox-class}
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @examples 
 #' \dontrun{

Modified: pkg/stacomir/R/RefChoix.r
===================================================================
--- pkg/stacomir/R/RefChoix.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/RefChoix.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -35,6 +35,7 @@
 #' @return An S4 object of class RefChoix
 #' @param object An object of class RefChoix
 #' @param vecteur A vector of name, see example code.
+#' @param label Labels for the choices
 #' @param selected An integer indicating which object is selected at launch
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @examples 

Modified: pkg/stacomir/R/RefCoe.r
===================================================================
--- pkg/stacomir/R/RefCoe.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/RefCoe.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -40,6 +40,7 @@
 #' 
 #' 
 #' The slots datedebut and datefin have to be filled before using charge
+#' @param object An object of class \link{RefCoe-class}
 #' @return Object of class RefCoe
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @examples 

Modified: pkg/stacomir/R/fn_EcritBilanJournalier.r
===================================================================
--- pkg/stacomir/R/fn_EcritBilanJournalier.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/fn_EcritBilanJournalier.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -71,7 +71,6 @@
 			zz=i/nrow(t_bilanmigrationjournalier_bjo)
 			progress_bar$setFraction(zz)
 			progress_bar$setText(sprintf("%d%% progression",round(100*zz)))
-			# TODO verifier si nécessaire ci dessous
 			RGtk2::gtkMainIterationDo(FALSE)
 #			utils::setWinProgressBar(progres,
 #					zz,
@@ -86,7 +85,7 @@
 					"bjo_dis_identifiant,bjo_tax_code,bjo_std_code,bjo_annee,bjo_jour,bjo_valeur,bjo_labelquantite,bjo_horodateexport,bjo_org_code)",
 					" VALUES " ,"('",paste(t_bilanmigrationjournalier_bjo[i,],collapse="','"),"');",sep="")
 			# to avoid printing character use of invisible (capture_output(
-		invisible(capture_output(stacomirtools::connect(requete)))
+		invisible(utils::capture.output(stacomirtools::connect(requete)))
 			
 		} # end for
 		if (!silent){
@@ -146,7 +145,7 @@
 					"bjo_dis_identifiant,bjo_tax_code,bjo_std_code,bjo_annee,bjo_jour,bjo_valeur,bjo_labelquantite,bjo_horodateexport,bjo_org_code)",
 					" VALUES " ,
 					"('",paste(t_bilanmigrationjournalier_bjo[i,],collapse="','"),"');",sep="")
-			invisible(capture_output(stacomirtools::connect(requete)))
+			invisible(utils::capture.output(stacomirtools::connect(requete)))
 		} # end for
 		if (!silent) funout(paste(get("msg",envir=envir_stacomi)$fn_EcritBilanJournalier.5,"\n"))
 		taxon= as.character(bilanMigration at taxons@data$tax_nom_latin)

Modified: pkg/stacomir/R/fn_EcritBilanMensuel.r
===================================================================
--- pkg/stacomir/R/fn_EcritBilanMensuel.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/fn_EcritBilanMensuel.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -36,7 +36,7 @@
 		requete at sql=paste("INSERT INTO ",get("sch",envir=envir_stacomi),"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_bilanmigrationmensuel_bme[i,],collapse="','"),"');",sep="")
-		invisible(capture_output(stacomirtools::connect(requete)))
+		invisible(utils::capture.output(stacomirtools::connect(requete)))
 	} # end for
 if (!silent) funout(paste(get("msg",envir=envir_stacomi)$fn_EcritBilanMensuel.1,"\n"))
 } # end function

Modified: pkg/stacomir/R/funSousListeBilanMigrationPar.r
===================================================================
--- pkg/stacomir/R/funSousListeBilanMigrationPar.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/funSousListeBilanMigrationPar.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -10,18 +10,11 @@
 # Notes de devt                     Dans les requetes recuperer valeurs quan ou valeur qual ou l'interrogation croisee (trois cas differents)
 #                      
 #**********************************************************************
-#*
-#* Modifications :
 
-# load(file="EXAMPLES/devt.Rdata")
-#@param  bilanMigrationPar
-#@return une liste de deux dataframe
 
 
 
 
-
-
 #' funSousListeBilanMigrationPar
 #' 
 #' see \code{funSousListeBilanMigration} This function is similar to

Modified: pkg/stacomir/R/interface_BilanFonctionnementDF.r
===================================================================
--- pkg/stacomir/R/interface_BilanFonctionnementDF.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/interface_BilanFonctionnementDF.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -43,7 +43,6 @@
 			Quit = aQuit)
 	
 	add(group, gmenu(toolbarlist))
-	add(group,gbutton(text = "graph", handler = function(h,...){X11()})) 
 	gWidgets::addSpring(group)
 	dev.new()
 }
\ No newline at end of file

Modified: pkg/stacomir/R/stacomi.r
===================================================================
--- pkg/stacomir/R/stacomi.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/stacomi.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -144,7 +144,7 @@
 		con=new("ConnectionODBC")
 		con at baseODBC=get("baseODBC",envir=envir_stacomi)
 		e=expression(con<-connect(con))
-		con=tryCatch(eval(e),error=get("msg",envir=envir_stacomi)$interface_graphique_log.7) #finally=odbcClose(con at connection)clause inutile car si �a plante la connection n'est pas ouverte
+		con=tryCatch(eval(e),error=get("msg",envir=envir_stacomi)$interface_graphique_log.7) 
 		test<-con at etat==get("msg",envir=envir_stacomi)$ConnectionODBC.6
 		odbcCloseAll()
 	}
@@ -268,7 +268,6 @@
 #' @import methods
 #' @import stacomirtools
 #' @import RODBC
-#' @import Hmisc
 #' @import RGtk2
 #' @import dplyr
 #' @importFrom intervals Intervals
@@ -296,7 +295,6 @@
 #' @importFrom lubridate round_date
 #' @importFrom lubridate floor_date
 #' @importFrom lubridate %m+%
-#' @importFrom lubridate %d+%
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @examples
 #' 
@@ -316,7 +314,7 @@
 	# first loading of connection and odbc info using chargexml()
 	envir_stacomi <- new.env(parent = emptyenv())
 	assign("envir_stacomi",envir_stacomi,.GlobalEnv)
-	# trois variables passées à interface graphique via envir_stacomi :
+	# trois variables passees a interface graphique via envir_stacomi :
 	assign("gr_interface",gr_interface,envir=envir_stacomi)	
 	assign("database_expected",database_expected,envir=envir_stacomi)
 	assign("login_window",login_window,envir=envir_stacomi)
@@ -452,8 +450,8 @@
 	menubarlist[[msg$interface_graphique_menu.3]]$lang$handler = hlang
 	menubarlist[[msg$interface_graphique_menu.3]]$lang$icon="dialog-info"
 	gWidgets::add(win, gmenu(menubarlist))
-	ggrouptotal<- gWidgets::ggroup(horizontal=FALSE)         # celui ci empile les autres de haut en bas
-	# gsortie est au dessus de la fenêtre
+	ggrouptotal<- gWidgets::ggroup(horizontal=FALSE)         # this one stacks from bottom to up
+	# gsortie is above the window
 	assign("ggrouptotal",ggrouptotal,envir=.GlobalEnv) 
 	
 	gWidgets::add(win,ggrouptotal)
@@ -485,8 +483,12 @@
 				"quantite_EXPERT","quantite_MESURE","quantite_PONCTUEL","libelle","null","type",
 				'val_libelle','lot_effectif','bilan_stades_pigm','ope_date_debut','p','g','poids_moyen',
 				'taxon_stades,"jour',"valeur","mintab","maxtab","moyenne","jour","total_annuel",
-				"taxon_stades","time.sequence","sum","variable"))
+				"taxon_stades","time.sequence","sum","variable","duree","Hdeb","Hfin","per_tar_code"))
 
+# variable used by dplyr
+utils::globalVariables(c("n0","newid","xmin","xmax"))
+
+
 # Assignation in global environment for the use of gWidget interface (there is no way arround this)
 utils::globalVariables(c("win","group","nbligne","ggrouptotal","ggrouptotal1","gSortie",
 				"col.sortie","ggroupboutons","ggroupboutonsbas","groupdate","groupdc","graphes",

Modified: pkg/stacomir/R/utilitaires.r
===================================================================
--- pkg/stacomir/R/utilitaires.r	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/R/utilitaires.r	2016-09-23 19:32:43 UTC (rev 214)
@@ -51,10 +51,10 @@
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @export
 fun_char_spe<-function(text){
-	text=gsub("\u00e9","e",text) #é
-	text=gsub("\u00e8","e",text) #è
-	text=gsub("\u00ea","e",text) #ê
-	text=gsub("\u00e0","a",text) #à
+	text=gsub("\u00e9","e",text) 
+	text=gsub("\u00e8","e",text) 
+	text=gsub("\u00ea","e",text) 
+	text=gsub("\u00e0","a",text) 
 	return(text)}
 
 
@@ -252,17 +252,19 @@
 #' @return A data frame with four new columns, Hmin (hour min), Hmax (hmax), xmin (day) and xmax (next day),
 #' and new rows
 #' @author cedric.briand
-#' @example
-#' datatemp<-structure(list(per_dis_identifiant = c(1L, 1L, 1L), per_date_debut = structure(c(1420056600, 
-#'								1420071000, 1420081200), class = c("POSIXct", "POSIXt"), tzone = ""), 
-#'				per_date_fin = structure(c(1420071000, 1420081200, 1421000000
-#'						), class = c("POSIXct", "POSIXt"), tzone = ""), per_commentaires = c("fonct calcul", 
-#'						"fonct calcul", "fonct calcul"), per_etat_fonctionnement = c(1L, 
-#'						0L, 0L), per_tar_code = 1:3, libelle = c("Fonc normal", "Arr ponctuel", 
-#'						"Arr maint")), .Names = c("per_dis_identifiant", "per_date_debut", 
-#'				"per_date_fin", "per_commentaires", "per_etat_fonctionnement", 
-#'				"per_tar_code", "libelle"), row.names = c(NA, 3L), class = "data.frame")
-#'newdf<-split_per_day(data=datatemp,horodatedebut="per_date_debut",horodatefin="per_date_fin")
+#' @examples
+#' datatemp<-structure(list(per_dis_identifiant = c(1L, 1L, 1L), 
+#' per_date_debut = structure(c(1420056600, 
+#'	1420071000, 1420081200), class = c("POSIXct", "POSIXt"), tzone = ""), 
+#'	per_date_fin = structure(c(1420071000, 1420081200, 1421000000
+#'	), class = c("POSIXct", "POSIXt"), tzone = ""), per_commentaires = c("fonct calcul", 
+#'	"fonct calcul", "fonct calcul"), per_etat_fonctionnement = c(1L, 
+#'	0L, 0L), per_tar_code = 1:3, libelle = c("Fonc normal", "Arr ponctuel", 
+#'	"Arr maint")), .Names = c("per_dis_identifiant", "per_date_debut", 
+#'	"per_date_fin", "per_commentaires", "per_etat_fonctionnement", 
+#'	"per_tar_code", "libelle"), row.names = c(NA, 3L), class = "data.frame")
+#'newdf<-split_per_day(data=datatemp,horodatedebut="per_date_debut",
+#' horodatefin="per_date_fin")
 #' @export
 split_per_day<-function(data,horodatedebut,horodatefin){
 	if(!horodatedebut%in%colnames(data)) stop("horodatedebut not in column names for data")
@@ -288,7 +290,7 @@
 	#replacing rows in data
 	data[match(data2$newid,data$newid),]<-data2
 	# now get the sequence of days righly set by adding the number of days to xmin and xmax
-	data3<-data%>%filter(n0>0)%>%group_by(id)%>%mutate(xmin=xmin+ as.difftime(rank(newid)-1, unit="days"),
+	data3<-data%>%filter(n0>0)%>%group_by(id)%>%mutate(xmin=xmin+ as.difftime(rank(newid)-1, units="days"),
 			xmax=xmax+as.difftime(rank(newid)-1, unit="days"))
 	data[match(data3$newid,data$newid),]<-data3
 	data<-as.data.frame(data)	

Deleted: pkg/stacomir/inst/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R
===================================================================
--- pkg/stacomir/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R	2016-09-01 18:46:49 UTC (rev 187)
+++ pkg/stacomir/inst/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R	2016-09-23 19:32:43 UTC (rev 214)
@@ -1,41 +0,0 @@
-library(stacomiR)
-
-stacomi(gr_interface=FALSE,login_window=FALSE,pre_launch_test=FALSE) 
-## launches the application in the command line
-## here an example of loading
-## not run as the program is possibly not installed
-## this example generates the bMM_Arzal dataset
-\dontrun{
-	stacomi(gr_interface=FALSE,
-			login_window=FALSE,
-			pre_launch_test=FALSE)	
-	bMM_Arzal=new("BilanMigrationMult")
-	bMM_Arzal=choice_c(bMM_Arzal,
-			dc=c(5,6,12),
-			taxons=c("Anguilla anguilla"),
-			stades=c("AGG","AGJ","CIV"),datedebut="2011-01-01",datefin="2011-12-31")
-	bMM_Arzal<-connect(bMM_Arzal)
-}
-
-
-data("bMM_Arzal")
-# use the following to get the raw data loaded by the connect method
-# not shown there as the database and program might not be installed
-
-#bMM_Arzal<-connect(bMM_Arzal)
-#str(bMM_Arzal at data)
-# calculations
-bMM_Arzal<-calcule(bMM_Arzal,silent=TRUE)
-#Individual plot for all DC, taxon and stage where data present
-#Silent=TRUE to turn off messages
-plot(bMM_Arzal,plot.type="standard",silent=TRUE)
-
-#cumulated migration at the station (all stages and DC grouped)
-plot(bMM_Arzal,plot.type="step")
-#some plots are a mixture of french and english
-#changing the reference table names to english should shift all to english.
-#same for spanish.
-# combined plot for ggplot2
-plot(bMM_Arzal,plot.type="multiple")
-# data will be written in the data directory specified in the stacomi/calcmig.csv file
-summary(bMM_Arzal,silent=TRUE)

Copied: pkg/stacomir/inst/examples/bilanFonctionnementDF_example.R (from rev 213, pkg/stacomir/examples/03_BilanFonctionnementDF/bilanFonctionnementDF_example.R)
===================================================================
--- pkg/stacomir/inst/examples/bilanFonctionnementDF_example.R	                        (rev 0)
+++ pkg/stacomir/inst/examples/bilanFonctionnementDF_example.R	2016-09-23 19:32:43 UTC (rev 214)
@@ -0,0 +1,26 @@
+require(stacomiR)
+stacomi(gr_interface=FALSE,
+		login_window=FALSE,
+		database_expected=FALSE)
+## An example that will work with the database installed only
+\dontrun{
+	bfDF=new("BilanFonctionnementDF")
+	bfDF<-choice_c(bfDF,
+			1,
+			horodatedebut="2015-01-01",
+			horodatefin="2015-12-31",
+			silent=TRUE)
+	# the times at Arzal are recorded continuously
+	# they are converted to date when a time appears while the hour is changing
+	# hence the following
+	Sys.setenv(TZ='GMT')
+	bfDF<-charge(bfDF)
+	plot(bfDF,plot.type="1")
+	plot(bfDF,plot.type="2",title="A nice title")
+	plot(bfDF,plot.type="3",title="A nice title")
+	plot(bfDF,plot.type="4")
+}
+
+  
+	
+

Copied: pkg/stacomir/inst/examples/bilanMigrationMult_Arzal.R (from rev 207, pkg/stacomir/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R)
===================================================================
--- pkg/stacomir/inst/examples/bilanMigrationMult_Arzal.R	                        (rev 0)
+++ pkg/stacomir/inst/examples/bilanMigrationMult_Arzal.R	2016-09-23 19:32:43 UTC (rev 214)
@@ -0,0 +1,45 @@
+library(stacomiR)
+
+stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE) 
+## launches the application in the command line
+## here an example of loading
+## not run as the program is possibly not installed
+## this example generates the bMM_Arzal dataset
+\dontrun{
+	stacomi(gr_interface=FALSE,
+			login_window=FALSE,
+			database_expected=FALSE)	
+	bMM_Arzal=new("BilanMigrationMult")
+	bMM_Arzal=choice_c(bMM_Arzal,
+			dc=c(5,6,12),
+			taxons=c("Anguilla anguilla"),
+			stades=c("AGG","AGJ","CIV"),datedebut="2011-01-01",datefin="2011-12-31")
+	bMM_Arzal<-connect(bMM_Arzal)
+}
+
+
+data("bMM_Arzal")
+# use the following to get the raw data loaded by the connect method
+# not shown there as the database and program might not be installed
+
+#bMM_Arzal<-connect(bMM_Arzal)
+#str(bMM_Arzal at data)
+# calculations
+bMM_Arzal<-calcule(bMM_Arzal,silent=TRUE)
+#Individual plot for all DC, taxon and stage where data present
+#Silent=TRUE to turn off messages
+# not run because of multiple graphical devices
+\dontrun{
+plot(bMM_Arzal,plot.type="standard",silent=TRUE)
+}
+#cumulated migration at the station (all stages and DC grouped)
+
+plot(bMM_Arzal,plot.type="step")
+
+#some plots are a mixture of french and english
+#changing the reference table names to english should shift all to english.
+#same for spanish.
+# combined plot for ggplot2
+plot(bMM_Arzal,plot.type="multiple")
+# data will be written in the data directory specified in the stacomi/calcmig.csv file
+summary(bMM_Arzal,silent=TRUE)

Copied: pkg/stacomir/inst/examples/bilanMigration_Arzal.R (from rev 206, pkg/stacomir/examples/02_BilanMigration/bilanMigration_Arzal.R)
===================================================================
--- pkg/stacomir/inst/examples/bilanMigration_Arzal.R	                        (rev 0)
+++ pkg/stacomir/inst/examples/bilanMigration_Arzal.R	2016-09-23 19:32:43 UTC (rev 214)
@@ -0,0 +1,41 @@
+library(stacomiR)
+
+stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE) 
+## launches the application in the command line
+## here an example of loading
+## not run as the program is possibly not installed
+## this example generates the bM_Arzal dataset
+\dontrun{
+	stacomi(gr_interface=FALSE,
+			login_window=FALSE,
+			database_expected=FALSE)	
+	bM_Arzal=new("BilanMigration")
+	bM_Arzal=choice_c(bM_Arzal,
+			dc=5,
+			taxons=c("Liza ramada"),
+			stades=c("IND"),
+			datedebut="2015-01-01",
+			datefin="2015-12-31")
+	bM_Arzal<-connect(bM_Arzal)
+}
+
+
+data("bM_Arzal")
+# use the following to get the raw data loaded by the connect method
+# not shown there as the database and program might not be installed
+
+#bM_Arzal<-connect(bM_Arzal)
+#str(bM_Arzal at data)
+# calculations
+bM_Arzal<-calcule(bM_Arzal,silent=TRUE)
+#Individual plot for all DC (standard), taxon and stage where data present
+#silent argument to stop all messages
+# this will also write daily and monthly migration balance to the database,
+# but only if stacomi has been run with argument : database_expected=FALSE
+plot(bM_Arzal,plot.type="standard",silent=TRUE)
+
+#cumulated migration at the station (all stages and DC grouped)
+plot(bM_Arzal,plot.type="step")
+
+# data will be written in the data directory specified in the stacomi/calcmig.csv file
+summary(bM_Arzal,silent=TRUE)

Modified: pkg/stacomir/inst/tests/testthat/test-00stacomir.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-00stacomir.R	2016-09-21 09:51:22 UTC (rev 213)
+++ pkg/stacomir/inst/tests/testthat/test-00stacomir.R	2016-09-23 19:32:43 UTC (rev 214)
@@ -196,15 +196,15 @@
 			baseODBC$uid=readline(prompt="Enter superuser name: ")
 			baseODBC$pwd=readline(prompt="Enter superuser password: ")	
 			req at baseODBC<-baseODBC
-			req at sql=paste("SELECT
-							distinct on (tc.constraint_name) tc.constraint_name, tc.table_name
+			req at sql=paste(stringr::str_c("SELECT
+							distinct on (tc.constraint_name) tc.constraint_name, tc.table_name							
 							FROM 
 							information_schema.table_constraints AS tc 
 							JOIN information_schema.key_column_usage AS kcu
 							ON tc.constraint_name = kcu.constraint_name
 							JOIN information_schema.constraint_column_usage AS ccu
 							ON ccu.constraint_name = tc.constraint_name
-							WHERE constraint_type = 'FOREIGN KEY';")
+							WHERE constraint_type = 'FOREIGN KEY' and  tc.constraint_schema='",gsub("\\.","",get("sch",envir=envir_stacomi)),"';"))
 			req<-stacomirtools::connect(req)
 			result<-req at query
 			fk<-structure(list(constraint_name = c("c_fk_act_lot_identifiant", 
@@ -223,25 +223,23 @@
 									"c_fk_lot_std_code", "c_fk_lot_tax_code", "c_fk_maa_mal_id", 
 									"c_fk_mac_valeurqualitatifdefaut", "c_fk_mae_mao_id", "c_fk_mae_stm_identifiant", 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/stacomir -r 214


More information about the Stacomir-commits mailing list