[Stacomir-commits] r386 - in pkg/stacomir: R inst/examples inst/tests/testthat man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 8 11:22:43 CEST 2017


Author: briand
Date: 2017-06-08 11:22:43 +0200 (Thu, 08 Jun 2017)
New Revision: 386

Modified:
   pkg/stacomir/R/BilanMigrationMultConditionEnv.r
   pkg/stacomir/inst/examples/bilanMigrationInterannuelle_example.R
   pkg/stacomir/inst/tests/testthat/test-00stacomir.R
   pkg/stacomir/inst/tests/testthat/test-02BilanMigration.R
   pkg/stacomir/inst/tests/testthat/test-06Bilan_MigrationInterAnnuelle.R
   pkg/stacomir/inst/tests/testthat/test-09Bilan_MigrationAnnuelle.R
   pkg/stacomir/inst/tests/testthat/test-11BilanMigrationMultConditionEnv.R
   pkg/stacomir/man/BilanMigrationInterAnnuelle-class.Rd
Log:
modifications for check

Modified: pkg/stacomir/R/BilanMigrationMultConditionEnv.r
===================================================================
--- pkg/stacomir/R/BilanMigrationMultConditionEnv.r	2017-06-08 08:27:04 UTC (rev 385)
+++ pkg/stacomir/R/BilanMigrationMultConditionEnv.r	2017-06-08 09:22:43 UTC (rev 386)
@@ -82,7 +82,8 @@
 							taxons=taxons,
 							stades=stades,
 							datedebut=datedebut,
-							datefin=datefin)
+							datefin=datefin,
+							silent=silent)
 			bmmCE at bilanConditionEnv=choice_c(bmmCE at bilanConditionEnv,
 					stationMesure=stationMesure,
 					datedebut=datedebut,
@@ -129,7 +130,7 @@
 setMethod("calcule",signature=signature("BilanMigrationMultConditionEnv"),definition=function(object,silent=FALSE){ 
 			# silent=FALSE
 			bmmCE<-object
-			bmmCE at bilanMigrationMult<-calcule(bmmCE at bilanMigrationMult)			
+			bmmCE at bilanMigrationMult<-calcule(bmmCE at bilanMigrationMult,silent=silent)			
 			if (!silent) funout(gettext("bmmCE object is stocked into envir_stacomi environment\n",domain="R-stacomiR"))
 			return(bmmCE)
 		})

Modified: pkg/stacomir/inst/examples/bilanMigrationInterannuelle_example.R
===================================================================
--- pkg/stacomir/inst/examples/bilanMigrationInterannuelle_example.R	2017-06-08 08:27:04 UTC (rev 385)
+++ pkg/stacomir/inst/examples/bilanMigrationInterannuelle_example.R	2017-06-08 09:22:43 UTC (rev 386)
@@ -38,51 +38,51 @@
 plot(bmi,plot.type="density",silent=TRUE)
 #install.packages("viridis")
 \dontrun{
-if (requireNamespace("ggplot2", quietly = TRUE)&
-		requireNamespace("viridis", quietly = TRUE)){
-g<-get("g",envir=envir_stacomi)	
-	g+
-	ggplot2::scale_fill_manual(values=viridis::viridis(22))+
-	ggplot2::ggtitle("Saisonnalite de la migration aux Enfrenaux")
-}
+	if (requireNamespace("ggplot2", quietly = TRUE)&
+			requireNamespace("viridis", quietly = TRUE)){
+		g<-get("g",envir=envir_stacomi)	
+		g+
+				ggplot2::scale_fill_manual(values=viridis::viridis(22))+
+				ggplot2::ggtitle("Saisonnalite de la migration aux Enfrenaux")
+	}
 # the standard plot is showing daily values
-plot(bmi,plot.type="standard",silent=TRUE)
+	plot(bmi,plot.type="standard",silent=TRUE)
 # Manual edition of the graph produced
-if (requireNamespace("ggplot2", quietly = TRUE)){
-	g1<-get("g1",envir=envir_stacomi)
-	g1<-g1+ggplot2::ggtitle("Les Enfrenaux")+
-		ggplot2::scale_fill_manual(name="Source", 
-				values=c("purple","#0A0C01"),
-				labels = c("historical set","2015 values"))+
-		ggplot2::scale_colour_manual(name="Source", values="#B8EA00",
-					labels = c("historical mean"))	+
-		ggplot2::ylab("Nombre d'anguilles")
-	print(g1)
-}
-
+	if (requireNamespace("ggplot2", quietly = TRUE)){
+		g1<-get("g1",envir=envir_stacomi)
+		g1<-g1+ggplot2::ggtitle("Les Enfrenaux")+
+				ggplot2::scale_fill_manual(name="Source", 
+						values=c("purple","#0A0C01"),
+						labels = c("historical set","2015 values"))+
+				ggplot2::scale_colour_manual(name="Source", values="#B8EA00",
+						labels = c("historical mean"))	+
+				ggplot2::ylab("Nombre d'anguilles")
+		print(g1)
+	}
+	
 # Another graph from scratch
-if (requireNamespace("ggplot2", quietly = TRUE)&
-		requireNamespace("viridis", quietly = TRUE)){
-dat<-funtraitementdate(bmi at data, # tableau de donnees a importer
-			"bjo_jour", # nom de la colonne
-			annee=FALSE,
-			mois=TRUE,
-			semaine =TRUE,
-			jour_mois=FALSE)
-	# sum per month
-res<-dplyr::select(dat,bjo_valeur,bjo_annee,semaine)
-res<-dplyr::group_by(res,bjo_annee,semaine)
-res<-dplyr::summarize(res,effectif=sum(bjo_valeur))
-ggplot2::ggplot(res, ggplot2::aes(x = semaine, y = bjo_annee,fill=effectif)) +
-		ggplot2::geom_tile(colour="black") + ggplot2::coord_fixed() +
-		viridis::scale_fill_viridis(begin=0,option="D") + ggplot2::theme_bw()+
-		ggplot2::theme(panel.background= ggplot2::element_rect(fill = "#9360A9"),
-				panel.grid.major=ggplot2::element_line(colour="#C1DB39"),
-				panel.grid.minor=ggplot2::element_line(colour="#7DD632"))+
-		ggplot2::ylab("year")+ggplot2::xlab("week")+
-		ggplot2::ggtitle("Historical trend at Les Enfrenaux Eel trap")
-	
-}
+	if (requireNamespace("ggplot2", quietly = TRUE)&
+			requireNamespace("viridis", quietly = TRUE)){
+		dat<-funtraitementdate(bmi at data, # tableau de donnees a importer
+				"bjo_jour", # nom de la colonne
+				annee=FALSE,
+				mois=TRUE,
+				semaine =TRUE,
+				jour_mois=FALSE)
+		# sum per month
+		res<-dplyr::select(dat,bjo_valeur,bjo_annee,semaine)
+		res<-dplyr::group_by(res,bjo_annee,semaine)
+		res<-dplyr::summarize(res,effectif=sum(bjo_valeur))
+		ggplot2::ggplot(res, ggplot2::aes(x = semaine, y = bjo_annee,fill=effectif)) +
+				ggplot2::geom_tile(colour="black") + ggplot2::coord_fixed() +
+				viridis::scale_fill_viridis(begin=0,option="D") + ggplot2::theme_bw()+
+				ggplot2::theme(panel.background= ggplot2::element_rect(fill = "#9360A9"),
+						panel.grid.major=ggplot2::element_line(colour="#C1DB39"),
+						panel.grid.minor=ggplot2::element_line(colour="#7DD632"))+
+				ggplot2::ylab("year")+ggplot2::xlab("week")+
+				ggplot2::ggtitle("Historical trend at Les Enfrenaux Eel trap")
+		
+	}
 # available arguments for timesplit are "quinzaine" and "mois" and "semaine"
 # with the silent=TRUE argument, it's always the latest year that is selected
 	plot(bmi,plot.type="barchart",timesplit="quinzaine",silent=TRUE)
@@ -96,26 +96,26 @@
 		g<-get("g",envir=envir_stacomi)	+ ggplot2::theme_minimal()
 		g+viridis::scale_color_viridis(discrete=TRUE)+
 				ggplot2::ggtitle("Cumulated migration step plot 
-at les Enfrenaux eel trap")
+								at les Enfrenaux eel trap")
 		
 	}
 	
-data("bmi_vichy")
+	data("bmi_vichy")
 # statistics for seaonal migration, daily values
-bmi_vichy<-calcule(bmi_vichy,timesplit="jour",silent=TRUE)
+	bmi_vichy<-calcule(bmi_vichy,timesplit="jour",silent=TRUE)
 #bmi_vichy at calcdata #check this to see the results
 # statistics for seaonal migration, weekly values
-bmi_vichy<-calcule(bmi_vichy,timesplit="semaine",silent=TRUE)
+	bmi_vichy<-calcule(bmi_vichy,timesplit="semaine",silent=TRUE)
 #bmi_vichy at calcdata
-
-
+	
+	
 # the plot method also runs calcule
-plot(bmi_vichy,plot.type="seasonal",timesplit="semaine",silent=TRUE)
-plot(bmi_vichy,plot.type="seasonal",timesplit="mois",silent=TRUE)
-plot(bmi_vichy,plot.type="seasonal",timesplit="jour",silent=TRUE)
-
-
-
+	plot(bmi_vichy,plot.type="seasonal",timesplit="semaine",silent=TRUE)
+	plot(bmi_vichy,plot.type="seasonal",timesplit="mois",silent=TRUE)
+	plot(bmi_vichy,plot.type="seasonal",timesplit="jour",silent=TRUE)
+	
+	
+	
 	# A test with lampreys in the Descarte DF (Vienne)
 	baseODBC<-get("baseODBC",envir=envir_stacomi)
 	baseODBC[c(2,3)]<-rep("logrami",2)
@@ -129,7 +129,7 @@
 			stades=c("5"),
 			anneedebut="2007",
 			anneefin="2014",
-			silent=FALSE)
+			silent=TRUE)
 	bmi_des<-charge(bmi_des)
 	bmi_des<-connect(bmi_des)	
 	bmi_des<-calcule(bmi_des,timesplit="semaine")

Modified: pkg/stacomir/inst/tests/testthat/test-00stacomir.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-00stacomir.R	2017-06-08 08:27:04 UTC (rev 385)
+++ pkg/stacomir/inst/tests/testthat/test-00stacomir.R	2017-06-08 09:22:43 UTC (rev 386)
@@ -77,6 +77,7 @@
 			require(stacomiR)
 			stacomi(gr_interface=TRUE,login_window=TRUE,database_expected=TRUE)
 			expect_true(exists("envir_stacomi"))
+			dispose(get("logw",envir_stacomi))
 			rm("envir_stacomi",envir =.GlobalEnv)
 		})
 

Modified: pkg/stacomir/inst/tests/testthat/test-02BilanMigration.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-02BilanMigration.R	2017-06-08 08:27:04 UTC (rev 385)
+++ pkg/stacomir/inst/tests/testthat/test-02BilanMigration.R	2017-06-08 09:22:43 UTC (rev 386)
@@ -7,8 +7,7 @@
 			baseODBC[c(2,3)]<-rep("iav",2)
 			assign("baseODBC",baseODBC,envir_stacomi)
 			sch<-get("sch",envir=envir_stacomi) # "iav."
-			assign("sch","iav.",envir_stacomi)
-			
+			assign("sch","iav.",envir_stacomi)			
 			bilanMigration<-new("BilanMigration")
 			options(warn = -1)
 			bilanMigration<-choice_c(bilanMigration,

Modified: pkg/stacomir/inst/tests/testthat/test-06Bilan_MigrationInterAnnuelle.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-06Bilan_MigrationInterAnnuelle.R	2017-06-08 08:27:04 UTC (rev 385)
+++ pkg/stacomir/inst/tests/testthat/test-06Bilan_MigrationInterAnnuelle.R	2017-06-08 09:22:43 UTC (rev 386)
@@ -157,7 +157,8 @@
 					taxons=bmM at taxons@data$tax_code, 
 					stades=bmM at stades@data$std_code, 
 					datedebut=as.character(bmM at pasDeTemps@dateDebut),
-					datefin=as.character(as.POSIXlt(DateFin(bmM at pasDeTemps))))
+					datefin=as.character(as.POSIXlt(DateFin(bmM at pasDeTemps))),
+					silent=TRUE)
 			bmM<-charge(bmM,silent=TRUE)
 			bmM<-connect(bmM,silent=TRUE)
 			bmM<-calcule(bmM,silent=TRUE)

Modified: pkg/stacomir/inst/tests/testthat/test-09Bilan_MigrationAnnuelle.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-09Bilan_MigrationAnnuelle.R	2017-06-08 08:27:04 UTC (rev 385)
+++ pkg/stacomir/inst/tests/testthat/test-09Bilan_MigrationAnnuelle.R	2017-06-08 09:22:43 UTC (rev 386)
@@ -41,8 +41,10 @@
 					anneedebut="1996",
 					anneefin="2015",
 					silent=TRUE)			
-			bilA<-connect(bilA,silent=TRUE)			
+			bilA<-connect(bilA,silent=TRUE)	
+			dev.new()
 			plot(bilA,silent=TRUE)
+			dev.new()
 			barplot(bilA)
 			rm("envir_stacomi",envir =.GlobalEnv)			
 		})
@@ -81,7 +83,9 @@
 			format.args = list(big.mark = " ", decimal.mark = ",")
 	))
 # barplot transforms the data, further arguments can be passed as to barplot
+			dev.new()
 	barplot(bilA)
+	dev.new()
 	barplot(bilA,
 			args.legend=list(x="topleft",bty = "n"),
 			col=c("#CA003E","#1A9266","#E10168","#005327","#FF9194"))
@@ -96,6 +100,8 @@
 				col=RColorBrewer::brewer.pal(9,"Spectral"),
 				beside=TRUE)
 	}
+	dev.new()
 	plot(bilAM,silent=TRUE)
+	graphics.off()
 })
 

Modified: pkg/stacomir/inst/tests/testthat/test-11BilanMigrationMultConditionEnv.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-11BilanMigrationMultConditionEnv.R	2017-06-08 08:27:04 UTC (rev 385)
+++ pkg/stacomir/inst/tests/testthat/test-11BilanMigrationMultConditionEnv.R	2017-06-08 09:22:43 UTC (rev 386)
@@ -35,10 +35,10 @@
 			bmmCE<-charge(bmmCE,silent=TRUE)
 			bmmCE<-connect(bmmCE,silent=TRUE)
 			bmmCE<-calcule(bmmCE,silent=TRUE)			
-			suppressWarnings(plot(bmmCE))
+			suppressWarnings(plot(bmmCE,silent=TRUE))
 			suppressWarnings(plot(bmmCE,
 					color_station=c("temp_gabion"="red","coef_maree"="blue","phases_lune"="pink"),
-					color_dc=c("5"="yellow","6"="orange","12"="purple")))
+					color_dc=c("5"="yellow","6"="orange","12"="purple"),silent=TRUE))
 			rm("envir_stacomi",envir =.GlobalEnv)
 		})
 

Modified: pkg/stacomir/man/BilanMigrationInterAnnuelle-class.Rd
===================================================================
--- pkg/stacomir/man/BilanMigrationInterAnnuelle-class.Rd	2017-06-08 08:27:04 UTC (rev 385)
+++ pkg/stacomir/man/BilanMigrationInterAnnuelle-class.Rd	2017-06-08 09:22:43 UTC (rev 386)
@@ -70,51 +70,51 @@
 plot(bmi,plot.type="density",silent=TRUE)
 #install.packages("viridis")
 \dontrun{
-if (requireNamespace("ggplot2", quietly = TRUE)&
-		requireNamespace("viridis", quietly = TRUE)){
-g<-get("g",envir=envir_stacomi)	
-	g+
-	ggplot2::scale_fill_manual(values=viridis::viridis(22))+
-	ggplot2::ggtitle("Saisonnalite de la migration aux Enfrenaux")
-}
+	if (requireNamespace("ggplot2", quietly = TRUE)&
+			requireNamespace("viridis", quietly = TRUE)){
+		g<-get("g",envir=envir_stacomi)	
+		g+
+				ggplot2::scale_fill_manual(values=viridis::viridis(22))+
+				ggplot2::ggtitle("Saisonnalite de la migration aux Enfrenaux")
+	}
 # the standard plot is showing daily values
-plot(bmi,plot.type="standard",silent=TRUE)
+	plot(bmi,plot.type="standard",silent=TRUE)
 # Manual edition of the graph produced
-if (requireNamespace("ggplot2", quietly = TRUE)){
-	g1<-get("g1",envir=envir_stacomi)
-	g1<-g1+ggplot2::ggtitle("Les Enfrenaux")+
-		ggplot2::scale_fill_manual(name="Source", 
-				values=c("purple","#0A0C01"),
-				labels = c("historical set","2015 values"))+
-		ggplot2::scale_colour_manual(name="Source", values="#B8EA00",
-					labels = c("historical mean"))	+
-		ggplot2::ylab("Nombre d'anguilles")
-	print(g1)
-}
-
+	if (requireNamespace("ggplot2", quietly = TRUE)){
+		g1<-get("g1",envir=envir_stacomi)
+		g1<-g1+ggplot2::ggtitle("Les Enfrenaux")+
+				ggplot2::scale_fill_manual(name="Source", 
+						values=c("purple","#0A0C01"),
+						labels = c("historical set","2015 values"))+
+				ggplot2::scale_colour_manual(name="Source", values="#B8EA00",
+						labels = c("historical mean"))	+
+				ggplot2::ylab("Nombre d'anguilles")
+		print(g1)
+	}
+	
 # Another graph from scratch
-if (requireNamespace("ggplot2", quietly = TRUE)&
-		requireNamespace("viridis", quietly = TRUE)){
-dat<-funtraitementdate(bmi at data, # tableau de donnees a importer
-			"bjo_jour", # nom de la colonne
-			annee=FALSE,
-			mois=TRUE,
-			semaine =TRUE,
-			jour_mois=FALSE)
-	# sum per month
-res<-dplyr::select(dat,bjo_valeur,bjo_annee,semaine)
-res<-dplyr::group_by(res,bjo_annee,semaine)
-res<-dplyr::summarize(res,effectif=sum(bjo_valeur))
-ggplot2::ggplot(res, ggplot2::aes(x = semaine, y = bjo_annee,fill=effectif)) +
-		ggplot2::geom_tile(colour="black") + ggplot2::coord_fixed() +
-		viridis::scale_fill_viridis(begin=0,option="D") + ggplot2::theme_bw()+
-		ggplot2::theme(panel.background= ggplot2::element_rect(fill = "#9360A9"),
-				panel.grid.major=ggplot2::element_line(colour="#C1DB39"),
-				panel.grid.minor=ggplot2::element_line(colour="#7DD632"))+
-		ggplot2::ylab("year")+ggplot2::xlab("week")+
-		ggplot2::ggtitle("Historical trend at Les Enfrenaux Eel trap")
-	
-}
+	if (requireNamespace("ggplot2", quietly = TRUE)&
+			requireNamespace("viridis", quietly = TRUE)){
+		dat<-funtraitementdate(bmi at data, # tableau de donnees a importer
+				"bjo_jour", # nom de la colonne
+				annee=FALSE,
+				mois=TRUE,
+				semaine =TRUE,
+				jour_mois=FALSE)
+		# sum per month
+		res<-dplyr::select(dat,bjo_valeur,bjo_annee,semaine)
+		res<-dplyr::group_by(res,bjo_annee,semaine)
+		res<-dplyr::summarize(res,effectif=sum(bjo_valeur))
+		ggplot2::ggplot(res, ggplot2::aes(x = semaine, y = bjo_annee,fill=effectif)) +
+				ggplot2::geom_tile(colour="black") + ggplot2::coord_fixed() +
+				viridis::scale_fill_viridis(begin=0,option="D") + ggplot2::theme_bw()+
+				ggplot2::theme(panel.background= ggplot2::element_rect(fill = "#9360A9"),
+						panel.grid.major=ggplot2::element_line(colour="#C1DB39"),
+						panel.grid.minor=ggplot2::element_line(colour="#7DD632"))+
+				ggplot2::ylab("year")+ggplot2::xlab("week")+
+				ggplot2::ggtitle("Historical trend at Les Enfrenaux Eel trap")
+		
+	}
 # available arguments for timesplit are "quinzaine" and "mois" and "semaine"
 # with the silent=TRUE argument, it's always the latest year that is selected
 	plot(bmi,plot.type="barchart",timesplit="quinzaine",silent=TRUE)
@@ -128,26 +128,26 @@
 		g<-get("g",envir=envir_stacomi)	+ ggplot2::theme_minimal()
 		g+viridis::scale_color_viridis(discrete=TRUE)+
 				ggplot2::ggtitle("Cumulated migration step plot 
-at les Enfrenaux eel trap")
+								at les Enfrenaux eel trap")
 		
 	}
 	
-data("bmi_vichy")
+	data("bmi_vichy")
 # statistics for seaonal migration, daily values
-bmi_vichy<-calcule(bmi_vichy,timesplit="jour",silent=TRUE)
+	bmi_vichy<-calcule(bmi_vichy,timesplit="jour",silent=TRUE)
 #bmi_vichy at calcdata #check this to see the results
 # statistics for seaonal migration, weekly values
-bmi_vichy<-calcule(bmi_vichy,timesplit="semaine",silent=TRUE)
+	bmi_vichy<-calcule(bmi_vichy,timesplit="semaine",silent=TRUE)
 #bmi_vichy at calcdata
-
-
+	
+	
 # the plot method also runs calcule
-plot(bmi_vichy,plot.type="seasonal",timesplit="semaine",silent=TRUE)
-plot(bmi_vichy,plot.type="seasonal",timesplit="mois",silent=TRUE)
-plot(bmi_vichy,plot.type="seasonal",timesplit="jour",silent=TRUE)
-
-
-
+	plot(bmi_vichy,plot.type="seasonal",timesplit="semaine",silent=TRUE)
+	plot(bmi_vichy,plot.type="seasonal",timesplit="mois",silent=TRUE)
+	plot(bmi_vichy,plot.type="seasonal",timesplit="jour",silent=TRUE)
+	
+	
+	
 	# A test with lampreys in the Descarte DF (Vienne)
 	baseODBC<-get("baseODBC",envir=envir_stacomi)
 	baseODBC[c(2,3)]<-rep("logrami",2)
@@ -161,7 +161,7 @@
 			stades=c("5"),
 			anneedebut="2007",
 			anneefin="2014",
-			silent=FALSE)
+			silent=TRUE)
 	bmi_des<-charge(bmi_des)
 	bmi_des<-connect(bmi_des)	
 	bmi_des<-calcule(bmi_des,timesplit="semaine")



More information about the Stacomir-commits mailing list