[Stacomir-commits] r406 - in pkg/stacomir: R data inst/config inst/examples inst/tests/testthat man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jun 20 20:59:31 CEST 2017
Author: briand
Date: 2017-06-20 20:59:30 +0200 (Tue, 20 Jun 2017)
New Revision: 406
Modified:
pkg/stacomir/R/ref_checkbox.R
pkg/stacomir/R/ref_parquan.R
pkg/stacomir/R/report_dc.R
pkg/stacomir/R/report_df.R
pkg/stacomir/R/report_mig_env.R
pkg/stacomir/R/utilities.R
pkg/stacomir/data/r_mig.rda
pkg/stacomir/inst/config/generate_data.R
pkg/stacomir/inst/examples/report_annual-example.R
pkg/stacomir/inst/examples/report_mig-example.R
pkg/stacomir/inst/examples/report_mig_mult-example.R
pkg/stacomir/inst/tests/testthat/test-09-report_annual.R
pkg/stacomir/inst/tests/testthat/test-50-spell_checking.R
pkg/stacomir/man/progress_bar.Rd
pkg/stacomir/man/ref_checkbox-class.Rd
pkg/stacomir/man/ref_parquan-class.Rd
pkg/stacomir/man/report_annual-class.Rd
pkg/stacomir/man/report_mig-class.Rd
pkg/stacomir/man/report_mig_mult-class.Rd
Log:
Modified: pkg/stacomir/R/ref_checkbox.R
===================================================================
--- pkg/stacomir/R/ref_checkbox.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/R/ref_checkbox.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -6,7 +6,6 @@
#' @slot checked A boolean vector
#' @section Objects from the Class: Objects can be created by calls of the form
#' \code{new("ref_checkbox", ...)}.
-#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
#' @family referential objects
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
setClass(Class="ref_checkbox",representation= representation(title="character",labels="character",checked="logical"),
Modified: pkg/stacomir/R/ref_parquan.R
===================================================================
--- pkg/stacomir/R/ref_parquan.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/R/ref_parquan.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -2,13 +2,6 @@
#'
#' Class enabling to load the list of quantitative parameters and to select one
#' of them. It inherits from 'ref_par', uses its 'choice' method
-#'
-#'
-#' @section Objects from the Class: Objects can be created by calls of the form
-#' \code{new("ref_parquan", data=data.frame())}. \describe{
-#' \item{list("data")}{Object of class \code{"data.frame"} ~ Quantitative
-#' parameters }\item{:}{Object of class \code{"data.frame"} ~ Quantitative
-#' parameters } }
#' @author cedric.briand"at"eptb-vilaine.fr
#' @keywords classes
#' @family referential objects
Modified: pkg/stacomir/R/report_dc.R
===================================================================
--- pkg/stacomir/R/report_dc.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/R/report_dc.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -271,7 +271,7 @@
assign("periodeDC",t_periodefonctdispositif_per_mois,envir_stacomi)
if (!silent) funout(gettext("Writing the table into envir_stacomi environment : write periodeDC=get('periodeDC',envir_stacomi)\n",domain="R-stacomiR"))
# the progress bar has been assigned in envir_stacomi, we destroy it
- gtkWidgetDestroy(get("progres",envir=envir_stacomi))
+ gtkWidgetDestroy(get("progress_bar",envir=envir_stacomi))
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
# PLOT OF TYPE BOX (plot.type=3)
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Modified: pkg/stacomir/R/report_df.R
===================================================================
--- pkg/stacomir/R/report_df.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/R/report_df.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -194,7 +194,6 @@
title=gettext("computing ...",domain="R-stacomiR"),
progress_text=gettext("Progress %",domain="R-stacomiR"))
progress_bar<-get("progress_bar",envir=envir_stacomi)
- # this function assigns
z=0 # compteur tableau t_periodefonctdispositif_per_mois
for(j in 1:nrow(t_periodefonctdispositif_per)){
#cat( j
@@ -252,7 +251,7 @@
assign("periodeDF",t_periodefonctdispositif_per_mois,envir_stacomi)
if (!silent) funout(gettext("Writing the table into envir_stacomi environment : write periodeDF=get('periodeDF',envir_stacomi)\n",domain="R-stacomiR"))
# the progress bar has been assigned in envir_stacomi, we destroy it
- gtkWidgetDestroy(get("progres",envir=envir_stacomi))
+ gtkWidgetDestroy(get("progress_bar",envir=envir_stacomi))
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
# PLOT OF TYPE BOX (plot.type=3)
#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Modified: pkg/stacomir/R/report_mig_env.R
===================================================================
--- pkg/stacomir/R/report_mig_env.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/R/report_mig_env.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -203,7 +203,7 @@
stations[stations$stm_identifiant==unique(tableauCE$env_stm_identifiant)[i],"stm_libelle"]
}
# the data can be in the POSIXct format, we need to round them
- tableauCE$date<-as.POSIXct(round.POSIXt(tableauCE$env_date_debut,units="days"))
+ tableauCE$date<-as.POSIXct(Hmisc::round.POSIXt(tableauCE$env_date_debut,units="days"))
qualitative<-!is.na(tableauCE$env_val_identifiant)
tableauCEquan<-tableauCE[!qualitative,]
tableauCEqual<-tableauCE[qualitative,]
Modified: pkg/stacomir/R/utilities.R
===================================================================
--- pkg/stacomir/R/utilities.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/R/utilities.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -232,7 +232,7 @@
#' @param width Width of the progress bar
#' @param height Height of the progress bar
#' @param pulse Do you want the widget to pulse
-#' @return nothing but progress_bar and dialog gwidgets are assigned to .GlobalEnv
+#' @return nothing
#'
#' @author cedric.briand
#' @examples
@@ -438,4 +438,4 @@
aa <- strsplit(attributes(odbc)$connection.string, ";")
dbname <- gsub("DATABASE=","",aa[[1]][2])
return(dbname)
-}
\ No newline at end of file
+}
Modified: pkg/stacomir/data/r_mig.rda
===================================================================
(Binary files differ)
Modified: pkg/stacomir/inst/config/generate_data.R
===================================================================
--- pkg/stacomir/inst/config/generate_data.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/inst/config/generate_data.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -112,12 +112,14 @@
datefin="2015-12-31")
r_mig<-charge(r_mig)
r_mig<-connect(r_mig)
+
r_mig at dc@data[,"dis_commentaires"]<-iconv(r_mig at dc@data[,"dis_commentaires"],from="latin1",to="UTF8")
r_mig at dc@data[,"type_df"]<-iconv(r_mig at dc@data[,"type_df"],from="latin1",to="UTF8")
r_mig at dc@data[,"type_dc"]<-iconv(r_mig at dc@data[,"type_dc"],from="latin1",to="UTF8")
r_mig at dc@data[,"dif_localisation"]<-iconv(r_mig at dc@data[,"dif_localisation"],from="latin1",to="UTF8")
r_mig at taxa@data[,"tax_nom_commun"]<-iconv(r_mig at taxa@data[,"tax_nom_commun"],from="latin1",to="UTF8")
r_mig at stage@data[,"std_libelle"]<-iconv(r_mig at stage@data[,"std_libelle"],from="latin1",to="UTF8")
+r_mig<-calcule(r_mig,silent=TRUE)
setwd("C:/workspace/stacomir/pkg/stacomir")
devtools::use_data(r_mig,internal=FALSE,overwrite=TRUE)
Modified: pkg/stacomir/inst/examples/report_annual-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_annual-example.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/inst/examples/report_annual-example.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -22,7 +22,7 @@
}
# the following dataset has been generated by the previous code
data(r_ann)
-xtr_ann<-xtable(r_ann,
+xtr_ann<-stacomiR::xtable(r_ann,
dc_name=c("Passe bassins","Piege anguille RG","Piege anguille RD"),
tax_name="Anguille",
std_name=c("Arg.","Jaun."))
Modified: pkg/stacomir/inst/examples/report_mig-example.R
===================================================================
--- pkg/stacomir/inst/examples/report_mig-example.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/inst/examples/report_mig-example.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -20,6 +20,7 @@
# launching charge will also load classes associated with the report
# e.g. report_ope, report_df, report_dc
r_mig<-connect(r_mig)
+ r_mig<-calcule(r_mig,silent=TRUE)
}
########################
# loading data
@@ -40,7 +41,7 @@
########################
# 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-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/inst/examples/report_mig_mult-example.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -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 (fails in linux, failing to load tcltk on R-forge)
+ r_mig_mult<-calcule(r_mig_mult,silent=TRUE)
}
# Use this as example if you don't have a connexion to the database
@@ -35,8 +37,7 @@
# 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/inst/tests/testthat/test-09-report_annual.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-09-report_annual.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/inst/tests/testthat/test-09-report_annual.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -49,7 +49,7 @@
rm("envir_stacomi",envir =.GlobalEnv)
})
-test_that("Test example report_mig_interannual-example",
+test_that("Test example report_mig_annual-example",
{
# check if built with examples (Rtools install --example)
# the file is generate it examples but later loaded to examples from the class using @example
@@ -63,46 +63,53 @@
test_that("Complement to example",
{
- data(r_ann)
- path=file.path(path.expand(get("datawd",envir=envir_stacomi)),
+ require(stacomiR)
+ stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
+ data(r_ann)
+ xtr_ann<-stacomiR::xtable(r_ann,
+ dc_name=c("Passe bassins","Piege anguille RG","Piege anguille RD"),
+ tax_name="Anguille",
+ std_name=c("Arg.","Jaun."))
+ path=file.path(path.expand(get("datawd",envir=envir_stacomi)),
paste(paste(r_ann at dc@dc_selectionne,collapse="+"),"_",
paste(r_ann at taxa@data$tax_code,collapse="+"),"_",
paste(r_ann at stage@data$std_code,collapse="+"),"_",
r_ann at anneedebut@annee_selectionnee,":",
r_ann at anneefin@annee_selectionnee,".html",sep=""),fsep ="/")
+
# here you can add an argument file=path
- expect_output(print(xtr_mig_annual,type="html"))
-
+ expect_output(print(xtr_ann,type="html"))
+
# the following uses the "addtorow" argument which creates nice column headings,
# format.args creates a thousand separator
# again this will need to be saved in a file using the file argument
- expect_output(print(xtr_mig_annual,
- add.to.row=get("addtorow",envir_stacomi),
- include.rownames = TRUE,
- include.colnames = FALSE,
- format.args = list(big.mark = " ", decimal.mark = ",")
- ))
+ expect_output(print(xtr_ann,
+ add.to.row=get("addtorow",envir_stacomi),
+ include.rownames = TRUE,
+ include.colnames = FALSE,
+ format.args = list(big.mark = " ", decimal.mark = ",")
+ ))
# barplot transforms the data, further arguments can be passed as to barplot
dev.new()
- barplot(r_ann)
- dev.new()
- barplot(r_ann,
+ barplot(r_ann)
+ dev.new()
+ barplot(r_ann,
args.legend=list(x="topleft",bty = "n"),
col=c("#CA003E","#1A9266","#E10168","#005327","#FF9194"))
-
+
# An example with custom arguments for legend.text (overriding plot defauts)
- data(r_ann_adour)
- if (requireNamespace("RColorBrewer", quietly = TRUE)){
+ data(r_ann_adour)
+ if (requireNamespace("RColorBrewer", quietly = TRUE)){
lesdc<-r_ann_adour at dc@data$dc_code[r_ann_adour at dc@data$dc%in%r_ann_adour at dc@dc_selectionne]
barplot(r_ann_adour,
legend.text=lesdc,
args.legend=list(x="topleft",bty = "n"),
col=RColorBrewer::brewer.pal(9,"Spectral"),
beside=TRUE)
- }
- dev.new()
- plot(r_ann_adour,silent=TRUE)
- graphics.off()
+ }
+ dev.new()
+ plot(r_ann_adour,silent=TRUE)
+ graphics.off()
})
test_that("test xtable method for report_annual",{
@@ -126,12 +133,13 @@
silent=TRUE)
r_ann<-connect(r_ann)
data(r_ann)
- xtr_mig_annual<-xtable(r_ann,
+ # if xtable is loaded to namespace, the function is masked ?
+ xtr_mig_annual<-stacomiR::xtable(r_ann,
dc_name=c("Passe bassins","Piege anguille RG","Piege anguille RD"),
tax_name="Anguille",
std_name=c("Arg.","Jaun."))
expect_equal(class(xtr_mig_annual)[1],"xtable","report_annual should have an xtable method")
- xtr_mig_annual<-xtable(r_ann,
+ xtr_mig_annual<-stacomiR::xtable(r_ann,
dc_name=c("Passe bassins","Piege anguille RG","Piege anguille RD"),
tax_name="Anguille",
std_name=c("Arg.","Jaun."))
Modified: pkg/stacomir/inst/tests/testthat/test-50-spell_checking.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-50-spell_checking.R 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/inst/tests/testthat/test-50-spell_checking.R 2017-06-20 18:59:30 UTC (rev 406)
@@ -1,6 +1,6 @@
-if (requireNamespace("lintr", quietly = TRUE)) {
- context(stringr::str_c("spell checking lints" ))
- test_that("Package Style", {
- lintr::expect_lint_free()
- })
-}
+#if (requireNamespace("lintr", quietly = TRUE)) {
+# context(stringr::str_c("spell checking lints" ))
+# test_that("Package Style", {
+# lintr::expect_lint_free()
+# })
+#}
Modified: pkg/stacomir/man/progress_bar.Rd
===================================================================
--- pkg/stacomir/man/progress_bar.Rd 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/man/progress_bar.Rd 2017-06-20 18:59:30 UTC (rev 406)
@@ -19,7 +19,7 @@
\item{pulse}{Do you want the widget to pulse}
}
\value{
-nothing but progress_bar and dialog gwidgets are assigned to .GlobalEnv
+nothing
}
\description{
Progress bar using a gtkdialog, the progress bar is assigned in envir_stacomi
Modified: pkg/stacomir/man/ref_checkbox-class.Rd
===================================================================
--- pkg/stacomir/man/ref_checkbox-class.Rd 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/man/ref_checkbox-class.Rd 2017-06-20 18:59:30 UTC (rev 406)
@@ -22,8 +22,6 @@
}
\author{
Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
-
-Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
}
\seealso{
Other referential.objects: \code{\link{charge,ref_choice-method}},
Modified: pkg/stacomir/man/ref_parquan-class.Rd
===================================================================
--- pkg/stacomir/man/ref_parquan-class.Rd 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/man/ref_parquan-class.Rd 2017-06-20 18:59:30 UTC (rev 406)
@@ -8,13 +8,6 @@
Class enabling to load the list of quantitative parameters and to select one
of them. It inherits from 'ref_par', uses its 'choice' method
}
-\section{Objects from the Class}{
- Objects can be created by calls of the form
-\code{new("ref_parquan", data=data.frame())}. \describe{
-\item{list("data")}{Object of class \code{"data.frame"} ~ Quantitative
-parameters }\item{:}{Object of class \code{"data.frame"} ~ Quantitative
-parameters } }
-}
\author{
cedric.briand"at"eptb-vilaine.fr
}
Modified: pkg/stacomir/man/report_annual-class.Rd
===================================================================
--- pkg/stacomir/man/report_annual-class.Rd 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/man/report_annual-class.Rd 2017-06-20 18:59:30 UTC (rev 406)
@@ -49,7 +49,7 @@
}
# the following dataset has been generated by the previous code
data(r_ann)
-xtr_ann<-xtable(r_ann,
+xtr_ann<-stacomiR::xtable(r_ann,
dc_name=c("Passe bassins","Piege anguille RG","Piege anguille RD"),
tax_name="Anguille",
std_name=c("Arg.","Jaun."))
Modified: pkg/stacomir/man/report_mig-class.Rd
===================================================================
--- pkg/stacomir/man/report_mig-class.Rd 2017-06-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/man/report_mig-class.Rd 2017-06-20 18:59:30 UTC (rev 406)
@@ -58,6 +58,7 @@
# launching charge will also load classes associated with the report
# e.g. report_ope, report_df, report_dc
r_mig<-connect(r_mig)
+ r_mig<-calcule(r_mig,silent=TRUE)
}
########################
# loading data
@@ -78,7 +79,7 @@
########################
# 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-20 17:21:25 UTC (rev 405)
+++ pkg/stacomir/man/report_mig_mult-class.Rd 2017-06-20 18:59:30 UTC (rev 406)
@@ -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 (fails in linux, failing to load tcltk on R-forge)
+ r_mig_mult<-calcule(r_mig_mult,silent=TRUE)
}
# Use this as example if you don't have a connexion to the database
@@ -81,8 +83,7 @@
# 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