[Stacomir-commits] r240 - in pkg/stacomir: R inst/examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 16 15:26:44 CET 2016


Author: briand
Date: 2016-12-16 15:26:44 +0100 (Fri, 16 Dec 2016)
New Revision: 240

Modified:
   pkg/stacomir/R/BilanMigrationMult.r
   pkg/stacomir/inst/examples/bilanMigration_Arzal.R
Log:


Modified: pkg/stacomir/R/BilanMigrationMult.r
===================================================================
--- pkg/stacomir/R/BilanMigrationMult.r	2016-12-04 15:18:10 UTC (rev 239)
+++ pkg/stacomir/R/BilanMigrationMult.r	2016-12-16 14:26:44 UTC (rev 240)
@@ -566,7 +566,11 @@
 				grdata<-stacomirtools::chnames(grdata,c("ope_dic_identifiant","lot_tax_code","lot_std_code"),c("DC","taxon","stade"))
 				grdata$DC<-as.factor(grdata$DC)
 				grdata$taxon<-as.factor(grdata$taxon)
-				if (length(unique(grdata$taxon))==1){
+				if (length(unique(grdata$taxon))==1&length(unique(grdata$stade))==1){
+					p<-ggplot(grdata,aes(x=debut_pas,y=effectif_total),fill="black")+
+							geom_bar(position="stack", stat="identity")+
+							facet_grid(DC~.,scales="free_y")
+				} else if (length(unique(grdata$taxon))==1){
 					p<-ggplot(grdata,aes(x=debut_pas,y=effectif_total,fill=stade))+
 							geom_bar(position="stack", stat="identity")+
 							facet_grid(DC~.,scales="free_y")+

Modified: pkg/stacomir/inst/examples/bilanMigration_Arzal.R
===================================================================
--- pkg/stacomir/inst/examples/bilanMigration_Arzal.R	2016-12-04 15:18:10 UTC (rev 239)
+++ pkg/stacomir/inst/examples/bilanMigration_Arzal.R	2016-12-16 14:26:44 UTC (rev 240)
@@ -16,25 +16,28 @@
 			stades=c("IND"),
 			datedebut="2015-01-01",
 			datefin="2015-12-31")
+	bM_Arzal<-charge(bM_Arzal)
 	bM_Arzal<-connect(bM_Arzal)
-	bM_Arzal<-charge(bM_Arzal)
 }
-
-
-data("bM_Arzal")
-# use the following to get the raw data loaded by the connect method
+########################
+# loading data
+## 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
-
-# All three classes were created by the charge and connect method 
+# All three classes bilan... were created by the charge and connect method 
 # of BilanMigrationMult
 # in the previous example
+################################
+data("bM_Arzal")
 data("bilanOperation_bM")
 assign("bilanOperation",bilanOperation_bM,envir=envir_stacomi)
 data("bilanFonctionnementDF_bM")
 assign("bilanFonctionnementDF",bilanFonctionnementDF_bM,envir=envir_stacomi)
 data("bilanFonctionnementDC_bM")
 assign("bilanFonctionnementDC",bilanFonctionnementDC_bM,envir=envir_stacomi)
+
+########################
 # 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
@@ -49,7 +52,7 @@
 \dontrun{
 	summary(bM_Arzal,silent=TRUE)
 }
-
+# this will write the daily bilan for later in in the bilannMigrationInterannuelle-class
 \dontrun{
 	fn_EcritBilanJournalier(bM_Arzal,silent=TRUE)
 }



More information about the Stacomir-commits mailing list