[Stacomir-commits] r586 - in pkg/stacomir: inst/examples man/figures

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 9 11:52:03 CET 2021


Author: briand
Date: 2021-11-09 11:52:03 +0100 (Tue, 09 Nov 2021)
New Revision: 586

Added:
   pkg/stacomir/man/figures/StationComptage.png
   pkg/stacomir/man/figures/interface_graph_taille_sat.png
   pkg/stacomir/man/figures/logo.png
Modified:
   pkg/stacomir/inst/examples/report_annual-example.R
   pkg/stacomir/inst/examples/report_dc-example.R
   pkg/stacomir/inst/examples/report_df-example.R
   pkg/stacomir/inst/examples/report_env-example.R
   pkg/stacomir/inst/examples/report_ge_weight-example.R
   pkg/stacomir/inst/examples/report_mig-example.R
   pkg/stacomir/inst/examples/report_mig_char-example.R
   pkg/stacomir/inst/examples/report_mig_env-example.R
   pkg/stacomir/inst/examples/report_mig_interannual-example.R
   pkg/stacomir/inst/examples/report_mig_mult-example.R
   pkg/stacomir/inst/examples/report_sample_char-example.R
   pkg/stacomir/inst/examples/report_sea_age-example.R
   pkg/stacomir/inst/examples/report_silver_eel-example.R
   pkg/stacomir/inst/examples/report_species-example.R
Log:
edited all examples

Modified: pkg/stacomir/inst/examples/report_annual-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_annual-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_annual-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,10 +1,23 @@
-require(stacomiR)
-# launching stacomi without selecting the scheme or interface
-stacomi(
-	database_expected=FALSE, sch='iav')
-# the following script will load the Arzal dataset if connected to iav schema
-
+# launching stacomi without database for demo
+stacomi(database_expected=FALSE)
+# the following piece of script will load the Arzal dataset and connected to iav postgres schema
+# it requires a working database
+# prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
+	stacomi(database_expected=TRUE, sch='iav')
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   r_ann<-new("report_annual")
   r_ann<-choice_c(r_ann,
 	  dc=c(5,6,12),

Modified: pkg/stacomir/inst/examples/report_dc-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_dc-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_dc-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,11 +1,24 @@
-require(stacomiR)
-stacomi(
-	database_expected=FALSE)
-###########################################################
-## An example that will work only if the database is present 
-## and the program installed and comprises the schema iav
-###########################################################"
+
+# this option allows to launch the program without the interface to display some of the program features.
+stacomi(database_expected=FALSE)
+# An example that will work only if the database is present 
+# and the program installed and comprises the schema iav
+# prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
+	
   r_dc=new("report_dc")
   r_dc<-choice_c(r_dc,
 	  5,

Modified: pkg/stacomir/inst/examples/report_df-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_df-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_df-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,8 +1,23 @@
-require(stacomiR)
 stacomi(
 	database_expected=FALSE)
-## An example that will work with the database installed only
+# An example that will work with the database installed only and schema iav in the database
+# prompt for user and password but you can set appropriate options for host, port and dbname
+stacomi(
+		database_expected=TRUE, sch='iav')	
 \dontrun{
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   r_df=new("report_df")
   r_df<-choice_c(r_df,
 	  1,

Modified: pkg/stacomir/inst/examples/report_env-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_env-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_env-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,7 +1,19 @@
-require(stacomiR)
 stacomi(
 	database_expected=FALSE)
 \dontrun{
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   r_env<-new("report_env")
   r_env<-choice_c(r_env,
 	  stationMesure=c("temp_gabion","coef_maree"),

Modified: pkg/stacomir/inst/examples/report_ge_weight-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_ge_weight-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_ge_weight-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -2,7 +2,24 @@
 # launching stacomi without selecting the scheme or interface
 stacomi(
 	database_expected=FALSE, sch='iav')
+# this requires a working database with the schema iav
+# prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
+	stacomi(
+			database_expected=TRUE, sch='iav')	
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   #create an instance of the class
   r_gew<-new("report_ge_weight")
   r_gew at liste<-charge(object=r_gew at liste,listechoice=c("=1",">1","tous"),label="")

Modified: pkg/stacomir/inst/examples/report_mig-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_mig-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_mig-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,11 +1,21 @@
-library(stacomiR)
-
 stacomi(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 r_mig dataset
-\dontrun{
+# If you have a working database
+# the following line of code will create the r_mig dataset from the iav (default) schema in the database
+\dontrun{	
+	stacomi(database_expected=TRUE)	
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   stacomi(
 	  database_expected=TRUE)	
   r_mig=new("report_mig")

Modified: pkg/stacomir/inst/examples/report_mig_char-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_mig_char-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_mig_char-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -2,8 +2,24 @@
 
 stacomi(
 	database_expected=FALSE, sch='logrami')
-
+# this requires a database with the schema logrami
+# prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
+	stacomi(
+			database_expected=TRUE, sch='logrami')	
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   r_mig_char<-new("report_mig_char")
   # here parqual is not in the list
   # so this is equivalent to parqual=NULL

Modified: pkg/stacomir/inst/examples/report_mig_env-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_mig_env-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_mig_env-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -3,7 +3,23 @@
 	database_expected=FALSE)
 # the following will load the data provided the user has access to the database
 # with data in the iav example scheme.
+# prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
+	stacomi(
+			database_expected=TRUE)	
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   r_mig_env<-new("report_mig_env")
   r_mig_env<-choice_c(r_mig_env,
 	  dc=c(5,6,12),

Modified: pkg/stacomir/inst/examples/report_mig_interannual-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_mig_interannual-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_mig_interannual-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -2,9 +2,24 @@
 # launching stacomi without selecting the scheme or interface
 stacomi(
 	database_expected=FALSE, sch='pmp')
-###### If you have connection to the database with the pmp scheme ############
+# If you have connection to the database with the pmp scheme 
+# prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
-  
+	stacomi(
+			database_expected=TRUE)	
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   # overriding user schema to point to Parc Marais Poitevin 
   # (longest historical dataset available
   # in France for eel ...) this suppose you have access to the pmp schema...

Modified: pkg/stacomir/inst/examples/report_mig_mult-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_mig_mult-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_mig_mult-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -6,9 +6,23 @@
 ## the following lines will only run if you have the program installed
 ## and the iav scheme available in the database
 ## this example generates the r_mig_mult dataset
+# prompt for user and password but you can set appropriate options for host, port and dbname
 \dontrun{
   stacomi(
 	  database_expected=TRUE)	
+if (interactive()){
+	if (!exists("user")){
+		user <- readline(prompt="Enter user: ")
+		password <- readline(prompt="Enter password: ")	
+	}	
+}
+options(					
+		stacomiR.dbname = "bd_contmig_nat",
+		stacomiR.host ="localhost",
+		stacomiR.port = "5432",
+		stacomiR.user = user,
+		stacomiR.user = password						
+)	
   r_mig_mult=new("report_mig_mult")
   r_mig_mult=choice_c(r_mig_mult,
 	  dc=c(5,6,12),

Modified: pkg/stacomir/inst/examples/report_sample_char-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_sample_char-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_sample_char-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,17 +1,30 @@
-require(stacomiR)
-# launching stacomi without selecting the scheme or interface
-stacomi(
-	database_expected=FALSE)
-# the following script will load the Arzal dataset 
-#if connected to iav schema
+# launching stacomi without connection to the database
+stacomi(	database_expected=FALSE)
+# If you have a working database
+# the following line of code will create the r_sample_char dataset from the iav (default) schema in the database
 \dontrun{
+	stacomi(database_expected=TRUE)	# uses default option sch = 'iav'
+	# prompt for user and password, you can set these in the options, including dbname and host
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
   #create an instance of the class
-  r_sample_char<-new("report_sample_char")
+  r_sample_char <- new("report_sample_char")
   # the following will load data for size, 
   # parameters 1786 (total size) C001 (size at video control)
   # dc 5 and 6 are fishways located on the Arzal dam
   # two stages are selected
-  r_sample_char<-choice_c(r_sample_char,
+  r_sample_char <- choice_c(r_sample_char,
 	  dc=c(5,6),
 	  taxa=c("Anguilla anguilla"),
 	  stage=c("AGJ","CIV"),
@@ -20,8 +33,8 @@
 	  horodatefin="2013-12-31",
 	  silent=FALSE)
   # two warning produced, ignored if silent=TRUE
-  r_sample_char<-connect(r_sample_char)
-  r_sample_char<-calcule(r_sample_char,silent=TRUE)
+  r_sample_char <- connect(r_sample_char)
+  r_sample_char <- calcule(r_sample_char,silent=TRUE)
   
 }	
 # load the dataset generated by previous lines

Modified: pkg/stacomir/inst/examples/report_sea_age-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_sea_age-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_sea_age-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,7 +1,24 @@
 require(stacomiR)
 stacomi(
-	database_expected=FALSE, sch= 'logrami')
+	database_expected=FALSE)
+# If you have a working database
+# the following line of code will create the r_seaa dataset from the logrami schema in the database
 \dontrun{
+		stacomi(database_expected=TRUE, sch='logrami')	# overrides the default option sch = 'iav'
+		# prompt for user and password, you can set these in the options, including dbname and host
+		if (interactive()){
+			if (!exists("user")){
+				user <- readline(prompt="Enter user: ")
+				password <- readline(prompt="Enter password: ")	
+			}	
+		}
+		options(					
+				stacomiR.dbname = "bd_contmig_nat",
+				stacomiR.host ="localhost",
+				stacomiR.port = "5432",
+				stacomiR.user = user,
+				stacomiR.user = password						
+		)	
   #create an instance of the class
   r_seaa<-new("report_sea_age")
   r_seaa<-choice_c(r_seaa,

Modified: pkg/stacomir/inst/examples/report_silver_eel-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_silver_eel-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_silver_eel-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,14 +1,28 @@
-require(stacomiR)
 # launching stacomi without selecting the scheme or interface
-stacomi(
-	database_expected=FALSE, sch ='fd80')
+stacomi(	database_expected=FALSE)
 # the following script will load data from the two Anguillere monitored in the Somme
 
+# If you have a working database
+# the following line of code will create the r_silver dataset from the "fd80." schema in the database
 \dontrun{
+	stacomi(database_expected=TRUE, sch="fd80.")	# overrides the default option sch = 'iav'
+	# prompt for user and password, you can set these in the options, including dbname and host
+	if (interactive()){
+		if (!exists("user")){
+			user <- readline(prompt="Enter user: ")
+			password <- readline(prompt="Enter password: ")	
+		}	
+	}
+	options(					
+			stacomiR.dbname = "bd_contmig_nat",
+			stacomiR.host ="localhost",
+			stacomiR.port = "5432",
+			stacomiR.user = user,
+			stacomiR.user = password						
+	)	
+	
   #create an instance of the class
   r_silver<-new("report_silver_eel")
-  sch<-rlang::env_get(envir_stacomi, "sch")
-  assign("sch","fd80.",envir_stacomi)
   r_silver<-choice_c(r_silver,
 	  dc=c(2,6),			
 	  horodatedebut="2010-09-01",

Modified: pkg/stacomir/inst/examples/report_species-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_species-example.R	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/inst/examples/report_species-example.R	2021-11-09 10:52:03 UTC (rev 586)
@@ -1,6 +1,10 @@
-require(stacomiR)
-stacomi(
-	database_expected=FALSE)
+# launching stacomi without selecting the scheme or interface
+stacomi(	database_expected=FALSE)
+# the following script will load data from the two Anguillere monitored in the Somme
+
+# If you have a working database
+# the following line of code will create the bilesp dataset from the "iav." schema in the database
+
 \dontrun{
   bilesp<-new("report_species")
   # split is one of "none", "year", "week", "month
@@ -10,27 +14,34 @@
 	  anneedebut="2008",
 	  anneefin="2012",
 	  silent=FALSE)	
-  #bilesp<-charge(bilesp) this is used by the graphical interface
-  bilesp<-connect(bilesp)
-  bilesp<-calcule(bilesp)
-  plot(bilesp,plot.type="pie",silent=FALSE)
-  plot(bilesp,plot.type="barplot",silent=FALSE)
-  bilesp<-choice_c(bilesp,
+  bilesp <- connect(bilesp)
+  bilesp <- calcule(bilesp)
+  plot(bilesp, plot.type="pie", silent=FALSE)
+  plot(bilesp, plot.type="barplot", silent=FALSE)
+  bilesp <- choice_c(bilesp,
 	  dc=c(5,6,12),
 	  split="month",
 	  anneedebut="2015",
 	  anneefin="2016",
 	  silent=FALSE)
-  bilesp<-charge(bilesp)
-  bilesp<-connect(bilesp)
-  plot(bilesp,plot.type="pie",silent=FALSE)
-  plot(bilesp,plot.type="barplot",silent=FALSE)
+  bilesp <- charge(bilesp)
+  bilesp <- connect(bilesp)
+  plot(bilesp, plot.type="pie", silent=FALSE)
+  plot(bilesp, plot.type="barplot", silent=FALSE)
   #length(unique(bilesp at calcdata$taxa_stage)) # 15
   # here creating a vector of length 15 with nice blending colours
+	if (requireNamespace("grDevices", quietly = TRUE) {
+	mycolorrampblue <-
+			grDevices::colorRampPalette(c("#395B74", "#010F19"))
+	mycolorrampyellow <-
+			grDevices::colorRampPalette(c("#B59C53", "#271D00"))
+	mycolorrampred <-
+			grDevices::colorRampPalette(c("#B56F53", "#270B00"))
   color<-c(mycolorrampblue(5),
 	  mycolorrampyellow(5),
 	  mycolorrampred(5))
   plot(bilesp,plot.type="barplot",color=color,silent=TRUE)
+	}
   summary(bilesp)
 }	
 

Added: pkg/stacomir/man/figures/StationComptage.png
===================================================================
(Binary files differ)

Index: pkg/stacomir/man/figures/StationComptage.png
===================================================================
--- pkg/stacomir/man/figures/StationComptage.png	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/man/figures/StationComptage.png	2021-11-09 10:52:03 UTC (rev 586)

Property changes on: pkg/stacomir/man/figures/StationComptage.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: pkg/stacomir/man/figures/interface_graph_taille_sat.png
===================================================================
(Binary files differ)

Index: pkg/stacomir/man/figures/interface_graph_taille_sat.png
===================================================================
--- pkg/stacomir/man/figures/interface_graph_taille_sat.png	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/man/figures/interface_graph_taille_sat.png	2021-11-09 10:52:03 UTC (rev 586)

Property changes on: pkg/stacomir/man/figures/interface_graph_taille_sat.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: pkg/stacomir/man/figures/logo.png
===================================================================
(Binary files differ)

Index: pkg/stacomir/man/figures/logo.png
===================================================================
--- pkg/stacomir/man/figures/logo.png	2021-11-09 10:05:16 UTC (rev 585)
+++ pkg/stacomir/man/figures/logo.png	2021-11-09 10:52:03 UTC (rev 586)

Property changes on: pkg/stacomir/man/figures/logo.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property


More information about the Stacomir-commits mailing list