[Stacomir-commits] r412 - in pkg/stacomir: R data inst/config inst/examples man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 22 08:38:33 CEST 2017


Author: briand
Date: 2017-06-22 08:38:33 +0200 (Thu, 22 Jun 2017)
New Revision: 412

Modified:
   pkg/stacomir/R/report_mig.R
   pkg/stacomir/R/report_mig_mult.R
   pkg/stacomir/data/r_mig_mult.rda
   pkg/stacomir/inst/config/generate_data.R
   pkg/stacomir/inst/examples/report_mig-example.R
   pkg/stacomir/inst/examples/report_mig_mult-example.R
   pkg/stacomir/man/calcule-report_mig_mult-method.Rd
   pkg/stacomir/man/fun_report_mig_mult.Rd
   pkg/stacomir/man/report_mig-class.Rd
   pkg/stacomir/man/report_mig_mult-class.Rd
Log:
problem with dplyr

Modified: pkg/stacomir/R/report_mig.R
===================================================================
--- pkg/stacomir/R/report_mig.R	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/R/report_mig.R	2017-06-22 06:38:33 UTC (rev 412)
@@ -69,7 +69,11 @@
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @keywords internal
 h_report_migcalc=function(h,...){
-  report_mig<-get("report_mig",envir=envir_stacomi)
+  if (exists("report_mig",envir_stacomi)) {
+	report_mig<-get("report_mig",envir_stacomi)
+  } else {      
+	funout(gettext("You need to launch computation first, clic on calc\n",domain="R-stacomiR"),arret=TRUE)
+  }
   report_mig<-charge(report_mig)
   report_mig<-connect(report_mig)
   report_mig<-calcule(report_mig)
@@ -369,12 +373,7 @@
 #' @export
 setMethod("plot",signature(x = "report_mig", y = "ANY"),definition=function(x, y,plot.type="standard",color=NULL, color_ope=NULL,silent=FALSE,...){ 
 	  #report_mig<-r_mig
-	  #report_mig<-x
-	  if (exists("report_mig",envir_stacomi)) {
-		report_mig<-get("report_mig",envir_stacomi)
-	  } else {      
-		funout(gettext("You need to launch computation first, clic on calc\n",domain="R-stacomiR"),arret=TRUE)
-	  }
+	  report_mig<-x
 	  ################################################################
 	  #                 standard plot
 	  ################################################################

Modified: pkg/stacomir/R/report_mig_mult.R
===================================================================
--- pkg/stacomir/R/report_mig_mult.R	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/R/report_mig_mult.R	2017-06-22 06:38:33 UTC (rev 412)
@@ -187,7 +187,10 @@
 #' different rows
 #' @param silent Default FALSE, should messages be stopped
 #' @note The class does not handle escapement rates, though structurally those are present in the database. If you 
-#' want to use those you will have to do the calculation manually from the data in \code{report_mig_mult at data}
+#' want to use those you will have to do the calculation manually from the data in \code{report_mig_mult at data}.
+#' Note also that running the calcule method requires to have a database called test in postgres, and empty
+#' database in which all sqldf group by queries are run. The user and password for the test database are taken 
+#' from the calcmig.csv configuration file.
 #' @return report_mig_mult with a list in slot calcdata. For each dc one will find a list with the following elements
 #' \describe{
 #' \item{method}{In the case of instantaneous periods (video counting) the sum of daily values is done by the \link{fun_report_mig_mult} method and the value indicated in method is "sum".
@@ -967,6 +970,8 @@
 #' @param time.sequence the time sequence to be filled in with new data
 #' @param datasub the initial dataset
 #' @param negative "boolean", default FALSE, TRUE indicates a separate sum for negative and positive migrations
+#' @note The method uses sqldf, configured to access a postgres database, and runs caclulations on a database called
+#' test (the username and password for test are set in the calcmig.csv configuration file). 
 #' @return A data.frame with number summed over over the time.sequence. 
 #' The function returns the same output than \link{fun_report_mig_mult_overlaps}
 #' but is intended to work faster

Modified: pkg/stacomir/data/r_mig_mult.rda
===================================================================
(Binary files differ)

Modified: pkg/stacomir/inst/config/generate_data.R
===================================================================
--- pkg/stacomir/inst/config/generate_data.R	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/inst/config/generate_data.R	2017-06-22 06:38:33 UTC (rev 412)
@@ -59,6 +59,7 @@
 r_mig_mult at dc@data[,"dif_localisation"]<-iconv(r_mig_mult at dc@data[,"dif_localisation"],from="latin1",to="UTF8")
 r_mig_mult at taxa@data[,"tax_nom_commun"]<-iconv(r_mig_mult at taxa@data[,"tax_nom_commun"],from="latin1",to="UTF8")
 r_mig_mult at stage@data[,"std_libelle"]<-iconv(r_mig_mult at stage@data[,"std_libelle"],from="latin1",to="UTF8")
+r_mig_mult<-calcule(r_mig_mult,silent=FALSE)
 setwd("C:/workspace/stacomir/pkg/stacomir")
 devtools::use_data(r_mig_mult,internal=FALSE,overwrite=TRUE)
 r_mig_mult_ope<-get("report_ope",envir=envir_stacomi)

Modified: pkg/stacomir/inst/examples/report_mig-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_mig-example.R	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/inst/examples/report_mig-example.R	2017-06-22 06:38:33 UTC (rev 412)
@@ -20,6 +20,10 @@
   # launching charge will also load classes associated with the report
   # e.g. report_ope, report_df, report_dc
   r_mig<-connect(r_mig)
+  ########################
+# calculations
+# note this requires to have a database test configured in postgres for use with sqldf  
+  ########################
   r_mig<-calcule(r_mig,silent=TRUE)
 }
 ########################
@@ -38,10 +42,7 @@
 data("r_mig_dc")
 assign("report_dc",r_mig_dc,envir=envir_stacomi)
 
-########################
-# calculations
-########################
-r_mig<-calcule(r_mig,silent=TRUE)
+
 #Individual plot for all DC (standard), taxa and stage where data present
 #silent argument to stop all messages
 plot(r_mig,plot.type="standard",silent=TRUE)

Modified: pkg/stacomir/inst/examples/report_mig_mult-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_mig_mult-example.R	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/inst/examples/report_mig_mult-example.R	2017-06-22 06:38:33 UTC (rev 412)
@@ -19,6 +19,8 @@
   # launching charge will also load classes associated with the report
   # e.g. report_ope, report_df, report_dc
   r_mig_mult<-connect(r_mig_mult)
+  # calculations 
+  r_mig_mult<-calcule(r_mig_mult,silent=TRUE)
  
 
 }
@@ -36,8 +38,7 @@
 assign("report_dc",r_mig_mult_dc,envir=envir_stacomi)
 # 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
-# calculations 
-r_mig_mult<-calcule(r_mig_mult,silent=TRUE)
+
 #Individual plot for all DC, taxa and stage where data present
 #Silent=TRUE to turn off messages
 # not run because of multiple graphical devices

Modified: pkg/stacomir/man/calcule-report_mig_mult-method.Rd
===================================================================
--- pkg/stacomir/man/calcule-report_mig_mult-method.Rd	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/man/calcule-report_mig_mult-method.Rd	2017-06-22 06:38:33 UTC (rev 412)
@@ -36,6 +36,9 @@
 }
 \note{
 The class does not handle escapement rates, though structurally those are present in the database. If you 
-want to use those you will have to do the calculation manually from the data in \code{report_mig_mult at data}
+want to use those you will have to do the calculation manually from the data in \code{report_mig_mult at data}.
+Note also that running the calcule method requires to have a database called test in postgres, and empty
+database in which all sqldf group by queries are run. The user and password for the test database are taken 
+from the calcmig.csv configuration file.
 }
 

Modified: pkg/stacomir/man/fun_report_mig_mult.Rd
===================================================================
--- pkg/stacomir/man/fun_report_mig_mult.Rd	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/man/fun_report_mig_mult.Rd	2017-06-22 06:38:33 UTC (rev 412)
@@ -22,6 +22,10 @@
 Function to calculate daily migration from migration monitoring whose length is less than one day,
  typically video recording whose period are instant events.
 }
+\note{
+The method uses sqldf, configured to access a postgres database, and runs caclulations on a database called
+test (the username and password for test are set in the calcmig.csv configuration file).
+}
 \author{
 Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 }

Modified: pkg/stacomir/man/report_mig-class.Rd
===================================================================
--- pkg/stacomir/man/report_mig-class.Rd	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/man/report_mig-class.Rd	2017-06-22 06:38:33 UTC (rev 412)
@@ -58,6 +58,10 @@
   # launching charge will also load classes associated with the report
   # e.g. report_ope, report_df, report_dc
   r_mig<-connect(r_mig)
+  ########################
+# calculations
+# note this requires to have a database test configured in postgres for use with sqldf  
+  ########################
   r_mig<-calcule(r_mig,silent=TRUE)
 }
 ########################
@@ -76,10 +80,7 @@
 data("r_mig_dc")
 assign("report_dc",r_mig_dc,envir=envir_stacomi)
 
-########################
-# calculations
-########################
-r_mig<-calcule(r_mig,silent=TRUE)
+
 #Individual plot for all DC (standard), taxa and stage where data present
 #silent argument to stop all messages
 plot(r_mig,plot.type="standard",silent=TRUE)

Modified: pkg/stacomir/man/report_mig_mult-class.Rd
===================================================================
--- pkg/stacomir/man/report_mig_mult-class.Rd	2017-06-22 05:56:35 UTC (rev 411)
+++ pkg/stacomir/man/report_mig_mult-class.Rd	2017-06-22 06:38:33 UTC (rev 412)
@@ -65,6 +65,8 @@
   # launching charge will also load classes associated with the report
   # e.g. report_ope, report_df, report_dc
   r_mig_mult<-connect(r_mig_mult)
+  # calculations 
+  r_mig_mult<-calcule(r_mig_mult,silent=TRUE)
  
 
 }
@@ -82,8 +84,7 @@
 assign("report_dc",r_mig_mult_dc,envir=envir_stacomi)
 # 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
-# calculations 
-r_mig_mult<-calcule(r_mig_mult,silent=TRUE)
+
 #Individual plot for all DC, taxa and stage where data present
 #Silent=TRUE to turn off messages
 # not run because of multiple graphical devices



More information about the Stacomir-commits mailing list