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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 6 13:34:03 CET 2017


Author: briand
Date: 2017-02-06 13:34:03 +0100 (Mon, 06 Feb 2017)
New Revision: 287

Modified:
   pkg/stacomir/R/BilanMigrationInterAnnuelle.r
   pkg/stacomir/inst/examples/bilanMigrationInterannuelle_example.R
   pkg/stacomir/inst/tests/testthat/test-06Bilan_MigrationInterAnnuelle.R
Log:


Modified: pkg/stacomir/R/BilanMigrationInterAnnuelle.r
===================================================================
--- pkg/stacomir/R/BilanMigrationInterAnnuelle.r	2017-02-05 21:34:03 UTC (rev 286)
+++ pkg/stacomir/R/BilanMigrationInterAnnuelle.r	2017-02-06 12:34:03 UTC (rev 287)
@@ -101,6 +101,7 @@
 				#----------------------------------------------------------------------
 				# MAIN LOOP, there can be several dic
 				#----------------------------------------------------------------------
+				dic<-object at dc@dc_selectionne
 				for (i in 1:length(dic)){
 					#i=1
 					############################################
@@ -216,6 +217,7 @@
 			# Final check for data
 			# index of data already present in the database
 			#-------------------------------------------------------------------------------------
+           les_annees=objet at anneeDebut@annee_selectionnee:objet at anneeFin@annee_selectionnee
 			index=unique(object at data$bjo_annee) %in% les_annees
 			# s'il manque des donnees pour certaines annees selectionnnees" 
 			if (!silent){

Modified: pkg/stacomir/inst/examples/bilanMigrationInterannuelle_example.R
===================================================================
--- pkg/stacomir/inst/examples/bilanMigrationInterannuelle_example.R	2017-02-05 21:34:03 UTC (rev 286)
+++ pkg/stacomir/inst/examples/bilanMigrationInterannuelle_example.R	2017-02-06 12:34:03 UTC (rev 287)
@@ -132,6 +132,7 @@
 	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")
 }	
 
 

Modified: pkg/stacomir/inst/tests/testthat/test-06Bilan_MigrationInterAnnuelle.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-06Bilan_MigrationInterAnnuelle.R	2017-02-05 21:34:03 UTC (rev 286)
+++ pkg/stacomir/inst/tests/testthat/test-06Bilan_MigrationInterAnnuelle.R	2017-02-06 12:34:03 UTC (rev 287)
@@ -23,7 +23,7 @@
 					anneefin=2015,
 					silent=TRUE)
 			bmi<-connect(bmi,silent=TRUE)	
-						# three warning produced, none shown due to silent=TRUE
+			# three warning produced, none shown due to silent=TRUE
 			options(warn = 0)
 			expect_s4_class(bmi,"BilanMigrationInterAnnuelle")
 			rm("envir_stacomi",envir =.GlobalEnv)
@@ -67,7 +67,7 @@
 			test<-file.access(example_path,0)
 			if (test[1]!=0) warnings("Package example dir not created ?") else
 				suppressWarnings(source(example_path))
-				
+			
 		})
 
 test_that("Test that loading two taxa will fail",
@@ -86,37 +86,40 @@
 			# dc 5 and 6 are fishways located on the Arzal dam
 			# two stages are selected
 			bmi<-suppressWarnings(choice_c(bmi,
-					dc=5,
-					taxons=c("Anguilla anguilla","Petromyzon marinus"),
-					stades=c("AGJ"),
-					anneedebut="1996",
-					anneefin=2015,
-					silent=TRUE))
-	     expect_error(charge(bmi))
+							dc=5,
+							taxons=c("Anguilla anguilla","Petromyzon marinus"),
+							stades=c("AGJ"),
+							anneedebut="1996",
+							anneefin=2015,
+							silent=TRUE))
+			expect_error(charge(bmi))
 			
 		})
 
 
 test_that("Test that bilanMigrationInterannuelle loads missing data with correct warning",
 		{
-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_cha<-new("BilanMigrationInterAnnuelle") #châtelrault
-bmi_cha<-suppressWarnings(choice_c(bmi_cha,
-		dc=c(21),
-		taxons=c("Salmo salar"),
-		stades=c("5"),
-		anneedebut="2004",
-		anneefin="2006",
-		silent=TRUE))
-
-bmi_cha<-charge(bmi_cha,silent=TRUE)
+			require(stacomiR)
+			stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
+			
+			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_cha<-new("BilanMigrationInterAnnuelle") #châtelrault
+			bmi_cha<-suppressWarnings(choice_c(bmi_cha,
+							dc=c(21),
+							taxons=c("Salmo salar"),
+							stades=c("5"),
+							anneedebut="2004",
+							anneefin="2006",
+							silent=TRUE))
+			
+			bmi_cha<-charge(bmi_cha,silent=TRUE)
 # deleting all data to ensure everything is loaded
-supprime(bmi_cha)
-bmi_cha<-connect(bmi_cha)
-
-})
+			supprime(bmi_cha)
+			bmi_cha<-connect(bmi_cha)
+			
+		})



More information about the Stacomir-commits mailing list