[Stacomir-commits] r177 - in pkg/stacomir: R data examples/01_BilanMigrationMult inst/config man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Aug 24 18:43:13 CEST 2016
Author: briand
Date: 2016-08-24 18:43:13 +0200 (Wed, 24 Aug 2016)
New Revision: 177
Modified:
pkg/stacomir/R/BilanMigrationMult.r
pkg/stacomir/R/fungraph.r
pkg/stacomir/R/fungraph_civelle.r
pkg/stacomir/data/bMM_Arzal.rda
pkg/stacomir/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R
pkg/stacomir/inst/config/generate_data.R
pkg/stacomir/man/BilanMigrationMult-class.Rd
pkg/stacomir/man/fungraph_civelle.Rd
pkg/stacomir/man/plot-BilanMigrationMult-ANY-method.Rd
Log:
all tests passing now !
Modified: pkg/stacomir/R/BilanMigrationMult.r
===================================================================
--- pkg/stacomir/R/BilanMigrationMult.r 2016-08-24 15:20:59 UTC (rev 176)
+++ pkg/stacomir/R/BilanMigrationMult.r 2016-08-24 16:43:13 UTC (rev 177)
@@ -325,11 +325,10 @@
# getGeneric("plot")
# showMethods("plot")
# methods("plot")
-setMethod("plot",signature(x = "BilanMigrationMult",y = "ANY"),definition=function(x, y="standard",...){
+setMethod("plot",signature(x = "BilanMigrationMult", y = "ANY"),definition=function(x, y,plot.type="standard",...){
#browser()
print("entering plot function")
#bilanMigrationMult<-bMM_Arzal
- plot.type<-y
bilanMigrationMult<-x
lestaxons= bilanMigrationMult at taxons@data
lesstades= bilanMigrationMult at stades@data
@@ -347,7 +346,7 @@
taxon=lestaxons[taxonnum,"tax_nom_latin"]
stade=lesstades[stadenum,"std_libelle"]
dc=lesdc[dcnum]
- print(paste(taxon,stade,dc))
+ #print(paste(taxon,stade,dc))
# preparation du jeu de donnees pour la fonction fungraph_civ
#developpee pour la classe BilanMigration
data<-bilanMigrationMult at calcdata[[stringr::str_c("dc_",dc)]][["data"]]
@@ -358,8 +357,8 @@
if (nrow(data)>0){
funout(paste("dc=",dc,
- taxon,
- stade))
+ "taxon"=taxon,
+ "stade"=stade))
if (any(duplicated(data$No.pas))) stop("duplicated values in No.pas")
data_without_hole<-merge(
data.frame(No.pas=as.numeric(strftime(bilanMigrationMult at time.sequence,format="%j"))-1,
@@ -464,7 +463,6 @@
}
#==========================type=3=============================
if (plot.type=="multiple"){
- bilanMigrationMult<-object
lestaxons= paste(bilanMigrationMult at taxons@data$tax_nom_latin,collapse=",")
lesstades= paste(bilanMigrationMult at stades@data$std_code,collapse=",")
grdata<-data.frame()
Modified: pkg/stacomir/R/fungraph.r
===================================================================
--- pkg/stacomir/R/fungraph.r 2016-08-24 15:20:59 UTC (rev 176)
+++ pkg/stacomir/R/fungraph.r 2016-08-24 16:43:13 UTC (rev 177)
@@ -17,6 +17,7 @@
#layout(mat)
# to adapt to bilanMigrationMult, default line...
#browser()
+ #cat("fungraph")
if (is.null(dc)) dc=bilanMigration at dc@dc_selectionne[1]
if(length(unique(tableau$type_de_quantite[!is.na(tableau$type_de_quantite)]))>1) funout(get("msg",envir=envir_stacomi)$fungraph.1)
annee=unique(strftime(as.POSIXlt(time.sequence),"%Y"))
@@ -57,7 +58,7 @@
main=paste(get("msg",envir=envir_stacomi)$fungraph.4,dis_commentaire,", ",taxon,", ",stade,", ",annee,sep=""),
cex.main=1,
...)
- print(gr)
+ nothing<-print(gr)
if(bilanMigration at pasDeTemps@stepDuration=="86400"){ # pas de temps journalier
index=as.vector(x[jmois==15])
axis(side=1,at=index,tick=TRUE,labels=mois)
@@ -335,7 +336,7 @@
###################################
# operations
###################################
- if(stacomirtools::is.odd(bilanMigration at dc@dc_selectionne)) brew="Paired" else brew="Accent"
+ if(stacomirtools::is.odd(dc)) brew="Paired" else brew="Accent"
rect( xleft =graphdate(as.POSIXct(t_operation_ope$ope_date_debut)),
ybottom=0,
xright=graphdate(as.POSIXct(t_operation_ope$ope_date_fin)),
@@ -364,15 +365,16 @@
fillname<-get("msg",envir=envir_stacomi)$fungraph.7[2] #type
mypalette<-rev(c("black","deepskyblue","chartreuse2","indianred"))
g<-ggplot(stktab, aes(x=mois,y=values,fill=ind))+
- geom_bar(position="stack", stat="identity")+
+ geom_bar(position="dodge", stat="identity")+
scale_fill_manual(name=fillname,values=c("MESURE"=mypalette[4],
"CALCULE"=mypalette[3],
"EXPERT"=mypalette[2],
"PONCTUEL"=mypalette[1]))+
xlab(get("msg",envir=envir_stacomi)$fungraph.7[4])+ # mois or month+
ylab(get("msg",envir=envir_stacomi)$fungraph.7[1]) # Nombre ou Numbers
- print(g)
+ nothing<-print(g)
# pour l'instant je ne peux pas combiner avec les autres => deux graphes
+return(invisible(NULL))
}
Modified: pkg/stacomir/R/fungraph_civelle.r
===================================================================
--- pkg/stacomir/R/fungraph_civelle.r 2016-08-24 15:20:59 UTC (rev 176)
+++ pkg/stacomir/R/fungraph_civelle.r 2016-08-24 16:43:13 UTC (rev 177)
@@ -13,9 +13,10 @@
#' @param stade the stage
#' @param dc the dc, default to null, only necessary for \code{\linkS4class{BilanMigrationMult}}
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
-fungraph_civelle=function(bilanMigration,table,time.sequenceime.sequence,taxon,stade,dc=null,...){
+fungraph_civelle=function(bilanMigration,table,time.sequence,taxon,stade,dc=null,...){
# calcul des variables
# pour adapter aux bilanMigrationMult, ligne par defaut...
+ #cat("fungraph_civelle")
if (is.null(dc)) dc=bilanMigration at dc@dc_selectionne[1]
annee=unique(strftime(as.POSIXlt(time.sequence),"%Y"))
mois= months(time.sequence)
Modified: pkg/stacomir/data/bMM_Arzal.rda
===================================================================
(Binary files differ)
Modified: pkg/stacomir/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R
===================================================================
--- pkg/stacomir/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R 2016-08-24 15:20:59 UTC (rev 176)
+++ pkg/stacomir/examples/01_BilanMigrationMult/bilanMigrationMult_Arzal.R 2016-08-24 16:43:13 UTC (rev 177)
@@ -27,11 +27,14 @@
# calculations
bMM_Arzal<-calcule(bMM_Arzal)
#Individual plot for all DC, taxon and stage where data present
-stacomiR::plot(bMM_Arzal,"standard")
+plot(bMM_Arzal,plot.type="standard")
#cumulated migration at the station (all stages and DC grouped)
-cumplot(bMM_Arzal)
+plot(bMM_Arzal,plot.type="step")
+#some plots are a mixture of french and english
+#changing the reference table names to english should shift all to english.
+#same for spanish.
# combined plot for ggplot2
-plot1(bMM_Arzal)
-# data will be written in the datadirectory specified in the stacomi/calcmig.csv file
+plot(bMM_Arzal,plot.type="multiple")
+# data will be written in the data directory specified in the stacomi/calcmig.csv file
summary(bMM_Arzal)
Modified: pkg/stacomir/inst/config/generate_data.R
===================================================================
--- pkg/stacomir/inst/config/generate_data.R 2016-08-24 15:20:59 UTC (rev 176)
+++ pkg/stacomir/inst/config/generate_data.R 2016-08-24 16:43:13 UTC (rev 177)
@@ -24,11 +24,11 @@
stades=c("AGG","AGJ","CIV"),datedebut="2011-01-01",datefin="2011-12-31")
bMM_Arzal<-connect(bMM_Arzal)
# to avoid warnings at package checks
-bMM_Arzal at dc@data[,"dis_commentaires"]<-iconv(bMM_Arzal at dc@data[,"dis_commentaires"],"UTF8")
-bMM_Arzal at dc@data[,"type_df"]<-iconv(bMM_Arzal at dc@data[,"type_df"],"UTF8")
-bMM_Arzal at dc@data[,"type_dc"]<-iconv(bMM_Arzal at dc@data[,"type_dc"],"UTF8")
-bMM_Arzal at dc@data[,"dif_localisation"]<-iconv(bMM_Arzal at dc@data[,"dif_localisation"],"UTF8")
-bMM_Arzal at taxons@data[,"tax_nom_commun"]<-iconv(bMM_Arzal at taxons@data[,"tax_nom_commun"],"UTF8")
-bMM_Arzal at stades@data[,"std_libelle"]<-iconv(bMM_Arzal at stades@data[,"std_libelle"],"UTF8")
+bMM_Arzal at dc@data[,"dis_commentaires"]<-iconv(bMM_Arzal at dc@data[,"dis_commentaires"],from="latin1",to="UTF8")
+bMM_Arzal at dc@data[,"type_df"]<-iconv(bMM_Arzal at dc@data[,"type_df"],from="latin1",to="UTF8")
+bMM_Arzal at dc@data[,"type_dc"]<-iconv(bMM_Arzal at dc@data[,"type_dc"],from="latin1",to="UTF8")
+bMM_Arzal at dc@data[,"dif_localisation"]<-iconv(bMM_Arzal at dc@data[,"dif_localisation"],from="latin1",to="UTF8")
+bMM_Arzal at taxons@data[,"tax_nom_commun"]<-iconv(bMM_Arzal at taxons@data[,"tax_nom_commun"],from="latin1",to="UTF8")
+bMM_Arzal at stades@data[,"std_libelle"]<-iconv(bMM_Arzal at stades@data[,"std_libelle"],from="latin1",to="UTF8")
setwd("F:/workspace/stacomir/pkg/stacomir")
devtools::use_data(bMM_Arzal,internal=FALSE,overwrite=TRUE)
\ No newline at end of file
Modified: pkg/stacomir/man/BilanMigrationMult-class.Rd
===================================================================
--- pkg/stacomir/man/BilanMigrationMult-class.Rd 2016-08-24 15:20:59 UTC (rev 176)
+++ pkg/stacomir/man/BilanMigrationMult-class.Rd 2016-08-24 16:43:13 UTC (rev 177)
@@ -72,13 +72,16 @@
# calculations
bMM_Arzal<-calcule(bMM_Arzal)
#Individual plot for all DC, taxon and stage where data present
-stacomiR::plot(bMM_Arzal,"standard")
+plot(bMM_Arzal,plot.type="standard")
#cumulated migration at the station (all stages and DC grouped)
-cumplot(bMM_Arzal)
+plot(bMM_Arzal,plot.type="step")
+#some plots are a mixture of french and english
+#changing the reference table names to english should shift all to english.
+#same for spanish.
# combined plot for ggplot2
-plot1(bMM_Arzal)
-# data will be written in the datadirectory specified in the stacomi/calcmig.csv file
+plot(bMM_Arzal,plot.type="multiple")
+# data will be written in the data directory specified in the stacomi/calcmig.csv file
summary(bMM_Arzal)
}
\author{
Modified: pkg/stacomir/man/fungraph_civelle.Rd
===================================================================
--- pkg/stacomir/man/fungraph_civelle.Rd 2016-08-24 15:20:59 UTC (rev 176)
+++ pkg/stacomir/man/fungraph_civelle.Rd 2016-08-24 16:43:13 UTC (rev 177)
@@ -5,7 +5,7 @@
\title{Graph function for glass eel migration. Differs from fungraph as it does not
draw the ggplot graph for month}
\usage{
-fungraph_civelle(bilanMigration, table, time.sequenceime.sequence, taxon, stade,
+fungraph_civelle(bilanMigration, table, time.sequence, taxon, stade,
dc = null, ...)
}
\arguments{
@@ -14,13 +14,13 @@
\item{table}{a data frame with the results}
+\item{time.sequence}{a vector POSIXt}
+
\item{taxon}{the species}
\item{stade}{the stage}
\item{dc}{the dc, default to null, only necessary for \code{\linkS4class{BilanMigrationMult}}}
-
-\item{time.sequence}{a vector POSIXt}
}
\description{
This graph will also plot numbers and bars according to whether the glass
Modified: pkg/stacomir/man/plot-BilanMigrationMult-ANY-method.Rd
===================================================================
--- pkg/stacomir/man/plot-BilanMigrationMult-ANY-method.Rd 2016-08-24 15:20:59 UTC (rev 176)
+++ pkg/stacomir/man/plot-BilanMigrationMult-ANY-method.Rd 2016-08-24 16:43:13 UTC (rev 177)
@@ -12,10 +12,10 @@
\item{y}{From the formals but missing}
-\item{...}{Additional arguments, see \code{plot}, \code{plot.default} and \code{par}}
-
\item{plot.type}{Defaut to \code{standard} the standard BilanMigration with dc and operation displayed, can also be \code{step} or
\code{multiple}}
+
+\item{...}{Additional arguments, see \code{plot}, \code{plot.default} and \code{par}}
}
\description{
\itemize{
More information about the Stacomir-commits
mailing list