[Stacomir-commits] r160 - in branch0.5/stacomir: . R inst/config inst/test man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Aug 19 21:34:12 CEST 2016
Author: briand
Date: 2016-08-19 21:34:11 +0200 (Fri, 19 Aug 2016)
New Revision: 160
Added:
branch0.5/stacomir/man/charge_complement-Refparqual-method.Rd
branch0.5/stacomir/man/choice-RefAnnee-method.Rd
branch0.5/stacomir/man/choice-RefCheckBox-method.Rd
branch0.5/stacomir/man/choice-RefChoix-method.Rd
branch0.5/stacomir/man/choice-RefDC-method.Rd
branch0.5/stacomir/man/choice-RefDF-method.Rd
branch0.5/stacomir/man/choice-RefHorodate-method.Rd
branch0.5/stacomir/man/choice-RefListe-method.Rd
branch0.5/stacomir/man/choice-RefStades-method.Rd
branch0.5/stacomir/man/choice-RefStationMesure-method.Rd
branch0.5/stacomir/man/choice-RefTaxon-method.Rd
branch0.5/stacomir/man/choice-RefTextBox-method.Rd
branch0.5/stacomir/man/choice-Refpar-method.Rd
branch0.5/stacomir/man/choice-Refparqual-method.Rd
branch0.5/stacomir/man/choice_c-BilanMigrationMult-method.Rd
branch0.5/stacomir/man/choice_c-PasDeTempsJournalier-method.Rd
branch0.5/stacomir/man/choice_c-RefDC-method.Rd
branch0.5/stacomir/man/choice_c-RefStades-method.Rd
branch0.5/stacomir/man/choice_c-RefTaxon-method.Rd
branch0.5/stacomir/man/choicemult-PasDeTemps-method.Rd
branch0.5/stacomir/man/choicemult-RefDC-method.Rd
branch0.5/stacomir/man/choicemult-RefStades-method.Rd
branch0.5/stacomir/man/choicemult-RefTaxon-method.Rd
Removed:
branch0.5/stacomir/man/chargecomplement-Refparqual-method.Rd
branch0.5/stacomir/man/choix-RefAnnee-method.Rd
branch0.5/stacomir/man/choix-RefCheckBox-method.Rd
branch0.5/stacomir/man/choix-RefChoix-method.Rd
branch0.5/stacomir/man/choix-RefDC-method.Rd
branch0.5/stacomir/man/choix-RefDF-method.Rd
branch0.5/stacomir/man/choix-RefHorodate-method.Rd
branch0.5/stacomir/man/choix-RefListe-method.Rd
branch0.5/stacomir/man/choix-RefStades-method.Rd
branch0.5/stacomir/man/choix-RefStationMesure-method.Rd
branch0.5/stacomir/man/choix-RefTaxon-method.Rd
branch0.5/stacomir/man/choix-RefTextBox-method.Rd
branch0.5/stacomir/man/choix-Refpar-method.Rd
branch0.5/stacomir/man/choix-Refparqual-method.Rd
branch0.5/stacomir/man/choixmult-PasDeTemps-method.Rd
branch0.5/stacomir/man/choixmult-RefDC-method.Rd
branch0.5/stacomir/man/choixmult-RefStades-method.Rd
branch0.5/stacomir/man/choixmult-RefTaxon-method.Rd
branch0.5/stacomir/man/load-BilanMigrationMult-method.Rd
branch0.5/stacomir/man/load-PasDeTempsJournalier-method.Rd
branch0.5/stacomir/man/load-RefDC-method.Rd
branch0.5/stacomir/man/load-RefStades-method.Rd
branch0.5/stacomir/man/load-RefTaxon-method.Rd
Modified:
branch0.5/stacomir/DESCRIPTION
branch0.5/stacomir/NAMESPACE
branch0.5/stacomir/R/BilanEspeces.r
branch0.5/stacomir/R/BilanFonctionnementDC.r
branch0.5/stacomir/R/BilanFonctionnementDF.r
branch0.5/stacomir/R/BilanMigration.r
branch0.5/stacomir/R/BilanMigrationConditionEnv.r
branch0.5/stacomir/R/BilanMigrationInterAnnuelle.r
branch0.5/stacomir/R/BilanMigrationMult.r
branch0.5/stacomir/R/BilanMigrationPar.r
branch0.5/stacomir/R/Bilan_poids_moyen.r
branch0.5/stacomir/R/Bilan_stades_pigm.r
branch0.5/stacomir/R/PasDeTempsJournalier.r
branch0.5/stacomir/R/PasdeTemps.r
branch0.5/stacomir/R/RefAnnee.r
branch0.5/stacomir/R/RefCheckBox.r
branch0.5/stacomir/R/RefChoix.r
branch0.5/stacomir/R/RefDC.r
branch0.5/stacomir/R/RefDF.r
branch0.5/stacomir/R/RefHorodate.r
branch0.5/stacomir/R/RefListe.r
branch0.5/stacomir/R/RefPoidsMoyenPeche.r
branch0.5/stacomir/R/RefStades.r
branch0.5/stacomir/R/RefStationMesure.r
branch0.5/stacomir/R/RefTaxon.r
branch0.5/stacomir/R/Refpar.r
branch0.5/stacomir/R/Refparqual.r
branch0.5/stacomir/R/Refparquan.r
branch0.5/stacomir/R/ReftextBox.r
branch0.5/stacomir/R/create_generic.r
branch0.5/stacomir/R/fn_EcritBilanJournalier.r
branch0.5/stacomir/R/fn_table_per_dis.r
branch0.5/stacomir/R/funstat.r
branch0.5/stacomir/R/funstatJournalier.r
branch0.5/stacomir/R/funtable.r
branch0.5/stacomir/R/interface_BilanConditionEnv.r
branch0.5/stacomir/R/interface_BilanFonctionnementDC.r
branch0.5/stacomir/R/interface_BilanFonctionnementDF.r
branch0.5/stacomir/R/interface_BilanMigration.r
branch0.5/stacomir/R/interface_BilanMigrationConditionEnv.r
branch0.5/stacomir/R/interface_BilanMigrationInterannuelle.r
branch0.5/stacomir/R/interface_BilanMigrationMult.r
branch0.5/stacomir/R/interface_BilanMigrationPar.r
branch0.5/stacomir/R/interface_Bilan_lot.r
branch0.5/stacomir/R/interface_Bilan_taille.r
branch0.5/stacomir/R/interface_bilan_poids_moyen.r
branch0.5/stacomir/R/interface_chooselang.r
branch0.5/stacomir/R/stacomi.r
branch0.5/stacomir/inst/config/generate_Roxygen2.R
branch0.5/stacomir/inst/config/libraries.r
branch0.5/stacomir/inst/config/stacomi_manual_launch.r
branch0.5/stacomir/inst/test/test-00stacomirbaseconnection.R
branch0.5/stacomir/man/RefAnnee-class.Rd
branch0.5/stacomir/man/RefCheckBox-class.Rd
branch0.5/stacomir/man/RefChoix-class.Rd
branch0.5/stacomir/man/RefCoe-class.Rd
branch0.5/stacomir/man/RefDC-class.Rd
branch0.5/stacomir/man/RefDF-class.Rd
branch0.5/stacomir/man/RefHorodate-class.Rd
branch0.5/stacomir/man/RefListe-class.Rd
branch0.5/stacomir/man/RefPoidsMoyenPeche-class.Rd
branch0.5/stacomir/man/RefStades-class.Rd
branch0.5/stacomir/man/Refpar-class.Rd
branch0.5/stacomir/man/Refparqual-class.Rd
branch0.5/stacomir/man/Refparquan-class.Rd
branch0.5/stacomir/man/Refperiode-class.Rd
branch0.5/stacomir/man/charge-RefChoix-method.Rd
branch0.5/stacomir/man/charge-RefMsg-method.Rd
branch0.5/stacomir/man/choix-methods.Rd
branch0.5/stacomir/man/fntablestade.Rd
branch0.5/stacomir/man/funstat.Rd
branch0.5/stacomir/man/funstatJournalier.Rd
branch0.5/stacomir/man/funtable.Rd
branch0.5/stacomir/man/graphe-methods.Rd
branch0.5/stacomir/man/hDF.Rd
branch0.5/stacomir/man/hbilanMigrationPargraph.Rd
branch0.5/stacomir/man/hbilanMigrationPargraph2.Rd
branch0.5/stacomir/man/hbilanMigrationParstat.Rd
branch0.5/stacomir/man/plot-BilanMigrationPar-ANY-method.Rd
Log:
changes to pass Rcheck
Modified: branch0.5/stacomir/DESCRIPTION
===================================================================
--- branch0.5/stacomir/DESCRIPTION 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/DESCRIPTION 2016-08-19 19:34:11 UTC (rev 160)
@@ -81,9 +81,9 @@
Depends:
R (>= 3.0.0),
methods,
- stacomirtools
+ stacomirtools,
+ RODBC
Imports:
- RODBC,
intervals,
RColorBrewer,
stringr,
@@ -96,7 +96,8 @@
graphics,
utils,
stats,
- lattice
+ lattice,
+ grDevices
Author: Cedric Briand [aut, cre],
Marion Legrand [aut]
Maintainer: Cedric Briand <cedric.briand00 at gmail.com>
Modified: branch0.5/stacomir/NAMESPACE
===================================================================
--- branch0.5/stacomir/NAMESPACE 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/NAMESPACE 2016-08-19 19:34:11 UTC (rev 160)
@@ -23,6 +23,7 @@
export(hbilanConditionEnvgraph)
export(hbilanMigrationConditionEnvcalc)
export(interface_BilanEspeces)
+export(stacomi)
exportClasses(BilanConditionEnv)
exportClasses(BilanEspeces)
exportClasses(BilanFonctionnementDC)
@@ -38,10 +39,10 @@
exportMethods(calcule)
exportMethods(charge)
exportMethods(charge_avec_filtre)
+exportMethods(choice_c)
exportMethods(connect)
exportMethods(createmessage)
exportMethods(cumplot)
-exportMethods(load)
exportMethods(plot1)
exportMethods(print)
exportMethods(setRefHorodate)
@@ -59,7 +60,6 @@
importFrom(grDevices,X11)
importFrom(grDevices,gray)
importFrom(grDevices,rainbow)
-importFrom(grDevices,x11)
importFrom(graphics,axis)
importFrom(graphics,axis.Date)
importFrom(graphics,layout)
Modified: branch0.5/stacomir/R/BilanEspeces.r
===================================================================
--- branch0.5/stacomir/R/BilanEspeces.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/BilanEspeces.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -169,7 +169,7 @@
if (min(tableEspeces$lot_effectif)<0) {funout(get("msg",envir_stacomi)$BilanEspeces.6)
tableEspeces$lot_effectif=abs(tableEspeces$lot_effectif)
}
- sumEspeces=switch(bilanEspeces at liste@listechoix,
+ sumEspeces=switch(bilanEspeces at liste@listechoice,
"annee"=as.data.frame(xtabs(lot_effectif~taxon_stades+annee,data=tableEspeces)),
"mois"=as.data.frame(xtabs(lot_effectif~taxon_stades+mois,data=tableEspeces)),
"semaine"=as.data.frame(xtabs(lot_effectif~taxon_stades+semaine,data=tableEspeces)),
@@ -181,8 +181,8 @@
g<-g+geom_bar(aes(x="",y=Effectif,fill=taxon_stades,width=1),stat="identity") +
ggtitle(paste("Bilan Especes, DC",bilanEspeces at dc@dc_selectionne,"\n",bilanEspeces at datedebut,"=>",bilanEspeces at datefin))
#theme(axis.line.x=element_line("none"))+theme(axis.title.x= element_text("none"))
- if (bilanEspeces at liste@listechoix!="aucun"){
- facet<-switch(bilanEspeces at liste@listechoix,
+ if (bilanEspeces at liste@listechoice!="aucun"){
+ facet<-switch(bilanEspeces at liste@listechoice,
"annee"=as.formula(~annee),
"mois"=as.formula(~mois),
"semaine"=as.formula(~semaine))
@@ -235,7 +235,7 @@
tableEspeces$lot_effectif=abs(tableEspeces$lot_effectif)
}
now<-bilanEspeces at horodate@horodate
- sumEspeces=switch(bilanEspeces at liste@listechoix,
+ sumEspeces=switch(bilanEspeces at liste@listechoice,
"annee"=as.data.frame(xtabs(lot_effectif~taxon_stades+annee,data=tableEspeces)),
"mois"=as.data.frame(xtabs(lot_effectif~taxon_stades+mois,data=tableEspeces)),
"semaine"=as.data.frame(xtabs(lot_effectif~taxon_stades+semaine,data=tableEspeces)),
@@ -263,20 +263,20 @@
assign("group",group,envir = .GlobalEnv)
gl=glabel(text=get("msg",envir=envir_stacomi)$interface_BilanEspeces.2,container=group)
add(ggroupboutons,group)
- choix(bilanEspeces at horodate,
+ choice(bilanEspeces at horodate,
label=get("msg",envir=envir_stacomi)$interface_Bilan_lot.3,
nomassign="bilanEspeces_date_debut",
funoutlabel=get("msg",envir=envir_stacomi)$interface_Bilan_lot.5,
decal=-2,
affichecal=FALSE)
- choix(bilanEspeces at horodate,
+ choice(bilanEspeces at horodate,
label=get("msg",envir=envir_stacomi)$interface_Bilan_lot.4,
nomassign="bilanEspeces_date_fin",
funoutlabel=get("msg",envir=envir_stacomi)$interface_Bilan_lot.6,
decal=-1,
affichecal=FALSE)
- choix(bilanEspeces at dc,objectBilan=bilanEspeces,is.enabled=TRUE)
- choix(bilanEspeces at liste)
+ choice(bilanEspeces at dc,objectBilan=bilanEspeces,is.enabled=TRUE)
+ choice(bilanEspeces at liste)
ggroupboutonsbas = gWidgets::ggroup(horizontal=FALSE)
assign("ggroupboutonsbas",ggroupboutonsbas, envir=.GlobalEnv)
gWidgets::add(ggroupboutons,ggroupboutonsbas)
@@ -291,6 +291,6 @@
#gWidgets::addSpring(group)
#graphes=ggraphics(width=600,height=400)
add(ggrouptotal1,graphes ) # on ajoute au groupe horizontal
- grDevice::X11()
+ grDevices::X11()
assign("graphes",graphes,envir=.GlobalEnv)
}
\ No newline at end of file
Modified: branch0.5/stacomir/R/BilanFonctionnementDC.r
===================================================================
--- branch0.5/stacomir/R/BilanFonctionnementDC.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/BilanFonctionnementDC.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -119,7 +119,7 @@
# l'objectif du programme ci dessous est de calculer la duree mensuelle de fonctionnement du dispositif.
tempsdebut<-strptime(t_periodefonctdispositif_per$per_date_debut,"%Y-%m-%d %H:%M:%S", tz = "GMT")
tempsfin<-strptime(t_periodefonctdispositif_per$per_date_fin,"%Y-%m-%d %H:%M:%S", tz = "GMT")
- # test la premiere horodate peut etre avant le choix de temps de debut, remplacer cette date par requete at datedebut
+ # test la premiere horodate peut etre avant le choice de temps de debut, remplacer cette date par requete at datedebut
tempsdebut[tempsdebut<fonctionnementDC at requete@datedebut]<-fonctionnementDC at requete@datedebut
# id pour fin
tempsfin[tempsfin>fonctionnementDC at requete@datefin]<-fonctionnementDC at requete@datefin
Modified: branch0.5/stacomir/R/BilanFonctionnementDF.r
===================================================================
--- branch0.5/stacomir/R/BilanFonctionnementDF.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/BilanFonctionnementDF.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -120,7 +120,7 @@
#tempsfin<-strptime(t_periodefonctdispositif_per$per_date_fin,"%Y-%m-%d %H:%M:%S", tz = "GMT")
tempsdebut<-t_periodefonctdispositif_per$per_date_debut
tempsfin<-t_periodefonctdispositif_per$per_date_fin
- # test la premiere horodate peut etre avant le choix de temps de debut, remplacer cette date par requete at datedebut
+ # test la premiere horodate peut etre avant le choice de temps de debut, remplacer cette date par requete at datedebut
tempsdebut[tempsdebut<fonctionnementDF at requete@datedebut]<-fonctionnementDF at requete@datedebut
# id pour fin
tempsfin[tempsfin>fonctionnementDF at requete@datefin]<-fonctionnementDF at requete@datefin
Modified: branch0.5/stacomir/R/BilanMigration.r
===================================================================
--- branch0.5/stacomir/R/BilanMigration.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/BilanMigration.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -239,8 +239,8 @@
p<-ggplot(bilanMigration at data)+
geom_step(aes(x=time.sequence,y=Cumsum,colour=mois))+
ylab(get("msg",envir_stacomi)$BilanMigration.6)+
- opts(plot.title=theme_text(size=10,colour="blue"),
- title=paste(get("msg",envir_stacomi)$BilanMigration.7,dis_commentaire,", ",taxon,", ",stade,", ",annee,sep=""))
+ ggtitle(paste(get("msg",envir_stacomi)$BilanMigration.7,dis_commentaire,", ",taxon,", ",stade,", ",annee,sep="")) +
+ theme(plot.title = element_text(size=10,colour="blue"))
print(p)
} else {
funout(get("msg",envir_stacomi)$BilanMigration.8)
@@ -267,6 +267,10 @@
stade= as.character(bilanMigration at stades@data$std_libelle)
DC=as.numeric(bilanMigration at dc@dc_selectionne)
funout(get("msg",envir_stacomi)$BilanMigration.9)
- resum=funstat(tableau=bilanMigration at data,time.sequence=bilanMigration at time.sequence,taxon,stade,DC)
+ resum=funstat(tableau=bilanMigration at data,
+ bilanMigration at time.sequence,
+ taxon,
+ stade,
+ DC)
funtable(tableau=bilanMigration at data,time.sequence=bilanMigration at time.sequence,taxon,stade,DC,resum)
}
\ No newline at end of file
Modified: branch0.5/stacomir/R/BilanMigrationConditionEnv.r
===================================================================
--- branch0.5/stacomir/R/BilanMigrationConditionEnv.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/BilanMigrationConditionEnv.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -162,7 +162,7 @@
funout(paste(get("msg",envir=envir_stacomi)$BilanMigrationConditionEnv.7,
sta,
get("msg",envir=envir_stacomi)$BilanMigrationConditionEnv.8,
- paste(unique(tableauCEst$env_date_debutchar[indrepeated(tableauCEst$env_date_debutchar)]),sep=""),
+ paste(unique(tableauCEst$env_date_debutchar[duplicated(tableauCEst$env_date_debutchar)]),sep=""),
get("msg",envir=envir_stacomi)$BilanMigrationConditionEnv.9),arret=FALSE)
tableauCEst<-tableauCEst[induk(tableauCEst$env_date_debutchar),]
}
Modified: branch0.5/stacomir/R/BilanMigrationInterAnnuelle.r
===================================================================
--- branch0.5/stacomir/R/BilanMigrationInterAnnuelle.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/BilanMigrationInterAnnuelle.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -199,37 +199,37 @@
dat=dat[dat$moyenne!=0,] # pour des raisons graphiques on ne garde pas les effectifs nuls generes par fundat
newdat=dat[match(unique(as.character(dat$jour)),as.character(dat$jour)),]
newdat=newdat[order(newdat$jour),] # pour avoir les range sur l'ensemble des valeurs dispo et pas seult l'annee en cours
- the_choix=select.list(choices=as.character(unique(dat$annee)[order(unique(dat$annee))]),
+ the_choice=select.list(choices=as.character(unique(dat$annee)[order(unique(dat$annee))]),
preselect=as.character(max(dat$annee)),
- "choix annee",multiple=TRUE)
+ "choice annee",multiple=TRUE)
amplitude=paste(min(as.numeric(as.character(dat$annee))),"-",max(as.numeric(as.character(dat$annee))),sep="")
- if (length(the_choix)>0) {
+ if (length(the_choice)>0) {
# le layout pour l'affichage des graphiques
vplayout <- function(x, y) { grid::viewport(layout.pos.row = x, layout.pos.col = y) }
grid::grid.newpage()
- grid::pushViewport(grid::viewport(layout = grid::grid.layout(length(the_choix),1,just="center")))
- for(i in 1:length(the_choix))
+ grid::pushViewport(grid::viewport(layout = grid::grid.layout(length(the_choice),1,just="center")))
+ for(i in 1:length(the_choice))
{
- amplitudechoix<-paste(the_choix[i],'/',amplitude)
- tmp <- dat[as.numeric(as.character(dat$annee))==as.numeric(the_choix)[i],]
+ amplitudechoice<-paste(the_choice[i],'/',amplitude)
+ tmp <- dat[as.numeric(as.character(dat$annee))==as.numeric(the_choice)[i],]
tmp$annee=as.character(tmp$annee)
g <- ggplot(newdat,aes(x=jour,y=valeur))
g <- g+geom_ribbon(aes(ymin=mintab, ymax=maxtab,fill="amplitude"),color="grey20")
g <- g+geom_bar(aes(fill=I("orange")),position="dodge",stat="identity",alpha=0.9,data=tmp)
- g<- g+ scale_fill_manual(name=eval(amplitudechoix), values=c("grey80","orange"),
- labels = c("amplitude historique",the_choix[i]))
+ g<- g+ scale_fill_manual(name=eval(amplitudechoice), values=c("grey80","orange"),
+ labels = c("amplitude historique",the_choice[i]))
g <- g+geom_point(aes(y=valeur,col=annee),data=tmp,size=0.5)
g <- g+ geom_line(aes(y=moyenne),col=I("brown"),data=tmp)
g <- g+geom_point(aes(y=moyenne,col=I("red")),size=0.8,data=tmp)
- g <- g+ scale_colour_manual(name=amplitudechoix, values=c("orange3","red"),
- labels=c(the_choix[i],stringr::str_c("Moyenne interannuelle",amplitude)))+
+ g <- g+ scale_colour_manual(name=amplitudechoice, values=c("orange3","red"),
+ labels=c(the_choice[i],stringr::str_c("Moyenne interannuelle",amplitude)))+
guides(fill = guide_legend(reverse=TRUE))
g <- g+labs(title=paste(bilanMigrationInterAnnuelle at taxons@data$tax_nom_latin,",",bilanMigrationInterAnnuelle at stades@data$std_libelle,unique(as.character(tmp$annee)),"/",amplitude))
g <- g+scale_x_datetime(name="effectif",breaks="months",minor_breaks="weeks", labels=date_format("%d-%m"))
g<-g+theme_bw()
print(g, vp=vplayout(i,1))
assign(paste("g",i,sep=""),g,envir_stacomi)
- funout(paste(get("msg",envir_stacomi)$BilanMigrationInterannuelle.10,"i=",paste(1:length(choix),collapse=","),"\n"))
+ funout(paste(get("msg",envir_stacomi)$BilanMigrationInterannuelle.10,"i=",paste(1:length(choice),collapse=","),"\n"))
} # end for
@@ -338,7 +338,7 @@
dat=fundat(dat)
#dat=dat[order(dat$annee,dat$jour),]
dat$valeur[is.na(dat$valeur)]<-0 # sinon si il ne reste qu'une ligne peut planter
- the_choix=select.list(choices=as.character(unique(dat$annee)),preselect=as.character(max(dat$annee)),"choix annee",multiple=FALSE)
+ the_choice=select.list(choices=as.character(unique(dat$annee)),preselect=as.character(max(dat$annee)),"choice annee",multiple=FALSE)
amplitude=paste(min(as.numeric(as.character(dat$annee))),"-",max(as.numeric(as.character(dat$annee))),sep="")
#################
# Calcul des cumsum
@@ -360,12 +360,15 @@
###################
g <- ggplot(dat,aes(x=jour,y=cumsum))
- tmp<-dat[as.numeric(as.character(dat$annee))==as.numeric(the_choix),]
+ tmp<-dat[as.numeric(as.character(dat$annee))==as.numeric(the_choice),]
g <- g+geom_step(aes(col=annee,size=total_annuel))
g <- g+geom_step(data=tmp,col="black",lty=2)
g<-g+labs(title=paste(bilanMigrationInterAnnuelle at taxons@data$tax_nom_latin,",",bilanMigrationInterAnnuelle at stades@data$std_libelle,get("msg",envir_stacomi)$BilanMigrationInterannuelle.9,amplitude))
g<-g+scale_y_continuous(name=get("msg",envir_stacomi)$BilanMigrationInterannuelle.8)
- g<-g+scale_x_date(name=get("msg",envir_stacomi)$BilanMigrationInterannuelle.7,breaks="months", minor_breaks="weeks", label=date_format("%b"),lim=range(dat[dat$valeur>0&dat$cumsum!=1,"jour"]))# date
+ g<-g+scale_x_date(name=get("msg",envir_stacomi)$BilanMigrationInterannuelle.7,breaks="months",
+ minor_breaks="weeks",
+ labels=date_format("%b"),
+ limits=range(dat[dat$valeur>0&dat$cumsum!=1,"jour"]))# date
g<-g+scale_colour_hue(name=get("msg",envir_stacomi)$BilanMigrationInterannuelle.6,l=70, c=150)# annee
print(g)
assign("g",g,envir_stacomi)
@@ -400,19 +403,19 @@
# dat=dat[dat$moyenne!=0,] # pour des raisons graphiques on ne garde pas les effectifs nuls generes par fundat
newdat=dat[match(unique(dat[,timesplit]),dat[,timesplit]),]
newdat=newdat[order(newdat[,"keeptimesplit"]),] # pour avoir les range sur l'ensemble des valeurs dispo et pas seult l'annee en cours
- thechoix=select.list(choices=as.character(unique(dat$annee)),preselect=as.character(max(as.numeric(as.character(dat$annee)))),"choix annee",multiple=TRUE)
+ thechoice=select.list(choices=as.character(unique(dat$annee)),preselect=as.character(max(as.numeric(as.character(dat$annee)))),"choice annee",multiple=TRUE)
amplitude=paste(min(as.numeric(as.character(dat$annee))),"-",max(as.numeric(as.character(dat$annee))),sep="")
# here change 12/2012 the geom_crossbar now needs a factor, label change according to timesplit
newdat[,timesplit]<-as.factor(newdat[,timesplit])
levels(newdat[,timesplit])<-newdat[,timesplit] # to have the factor in the right order from january to dec
- if (length(thechoix)>0) {
+ if (length(thechoice)>0) {
# le layout pour l'affichage des graphiques
vplayout <- function(x, y) { grid::viewport(layout.pos.row = x, layout.pos.col = y) }
grid::grid.newpage()
- grid::pushViewport(grid::viewport(layout = grid::grid.layout(length(thechoix),1,just="center")))
- for(i in 1:length(thechoix)) {
- selection=as.numeric(as.character(dat$annee))==as.numeric(thechoix)[i]
+ grid::pushViewport(grid::viewport(layout = grid::grid.layout(length(thechoice),1,just="center")))
+ for(i in 1:length(thechoice)) {
+ selection=as.numeric(as.character(dat$annee))==as.numeric(thechoice)[i]
tmp <- dat[selection,]
tmp[tmp$valeur>=tmp$moyenne,"comp"]<-">=moy"
tmp[tmp$valeur<tmp$moyenne,"comp"]<-"<moy"
@@ -437,12 +440,12 @@
# pb the limit truncs the value
g <- g+ylab("effectif")
cols <- c("max" = "blue","min" = "red",">=moy" = "darkgreen", "<moy" = "darkorange","0"="grey10")
- g <- g+scale_colour_manual(name=thechoix,values=cols)
+ g <- g+scale_colour_manual(name=thechoice,values=cols)
g<-g+labs(title=paste(bilanMigrationInterAnnuelle at taxons@data$tax_nom_latin,",",bilanMigrationInterAnnuelle at stades@data$std_libelle,", bilan par",timesplit,unique(as.character(tmp$annee)),"/",amplitude))
g<-g+ theme_bw()
print(g, vp=vplayout(i,1))
assign(paste("g",i,sep=""),g,envir_stacomi)
- funout(paste(get("msg",envir_stacomi)$BilanMigrationInterannuelle.10,"i=",paste(1:length(thechoix),collapse=","),"\n"))
+ funout(paste(get("msg",envir_stacomi)$BilanMigrationInterannuelle.10,"i=",paste(1:length(thechoice),collapse=","),"\n"))
} # end for
} # end if
} # end function
@@ -478,17 +481,17 @@
# levels(dat[,timesplit])<-newdat[,timesplit]
# levels(newdat[,timesplit])<-newdat[,timesplit]
- the_choix=select.list(choices=as.character(unique(dat$annee)),preselect=as.character(max(as.numeric(as.character(dat$annee)))),"choix annee",multiple=TRUE)
+ the_choice=select.list(choices=as.character(unique(dat$annee)),preselect=as.character(max(as.numeric(as.character(dat$annee)))),"choice annee",multiple=TRUE)
amplitude=paste(min(as.numeric(as.character(dat$annee))),"-",max(as.numeric(as.character(dat$annee))),sep="")
- if (length(the_choix)>0) {
+ if (length(the_choice)>0) {
# le layout pour l'affichage des graphiques
vplayout <- function(x, y) { grid::viewport(layout.pos.row = x, layout.pos.col = y) }
grid::grid.newpage()
- grid::pushViewport(grid::viewport(layout = grid::grid.layout(length(the_choix),1,just="center")))
- for(i in 1:length(the_choix)) {
- selection=as.numeric(as.character(dat$annee))==as.numeric(the_choix)[i]
+ grid::pushViewport(grid::viewport(layout = grid::grid.layout(length(the_choice),1,just="center")))
+ for(i in 1:length(the_choice)) {
+ selection=as.numeric(as.character(dat$annee))==as.numeric(the_choice)[i]
tmp <- dat[selection,]
tmp[tmp$valeur>=tmp$moyenne,"comp"]<-">=moy"
tmp[tmp$valeur<tmp$moyenne,"comp"]<-"<moy"
@@ -503,11 +506,11 @@
g<-g+geom_bar(stat="identity",aes_string(y="valeur",fill="comp"),alpha=0.7)
g <- g+scale_y_continuous(name="effectif")
cols <- c("max" = "blue","min" = "red",">=moy" = "darkgreen", "<moy" = "darkorange","0"="grey10")
- g <- g+scale_fill_manual(name=the_choix,values=cols)
+ g <- g+scale_fill_manual(name=the_choice,values=cols)
g<-g+labs(title=paste(bilanMigrationInterAnnuelle at taxons@data$tax_nom_latin,",",bilanMigrationInterAnnuelle at stades@data$std_libelle,", bilan par",timesplit,unique(as.character(tmp$annee)),"/",amplitude))
print(g, vp=vplayout(i,1))
assign(paste("g",i,sep=""),g,envir_stacomi)
- funout(paste(get("msg",envir_stacomi)$BilanMigrationInterannuelle.10,"i=",paste(1:length(the_choix),collapse=","),"\n"))
+ funout(paste(get("msg",envir_stacomi)$BilanMigrationInterannuelle.10,"i=",paste(1:length(the_choice),collapse=","),"\n"))
} # end for
} # end if
} # end function
@@ -549,8 +552,10 @@
dat=dat[order(dat$annee,dat[,timesplit]),]
g <- ggplot(dat,aes_string(x=timesplit,y="std_valeur"))
g<-g+geom_area(aes_string(y="std_valeur",fill="annee"),position="stack")
- g <- g+scale_x_datetime(name=paste("mois"),breaks="month",minor_breaks=getvalue(new("Refperiode"),timesplit),label=date_format("%b"),
- lim=as.POSIXct(c(trunc.POSIXt((min(dat[dat$valeur!=0,timesplit])),"month"),ceil.POSIXt((max(dat[dat$valeur!="0",timesplit])),"month"))))
+ g <- g+scale_x_datetime(name=paste("mois"),breaks="month",
+ minor_breaks=getvalue(new("Refperiode"),timesplit),
+ labels=date_format("%b"),
+ limits=as.POSIXct(c(trunc.POSIXt((min(dat[dat$valeur!=0,timesplit])),"month"),ceil.POSIXt((max(dat[dat$valeur!="0",timesplit])),"month"))))
g <- g+scale_y_continuous(name="Somme des pourcentages annuels de migration par quinzaine")
cols <- grDevices::rainbow(length(levels(dat$annee)))
g <- g+scale_fill_manual(name="annee",values=cols)
@@ -579,5 +584,10 @@
dat = dat[,-1]
tmp = dat$Jour
DC = bilanMigrationInterAnnuelle at dc@dc_selectionne
- funtable(tableau=dat,duree=tmp,taxon=bilanMigrationInterAnnuelle at taxons@data$tax_nom_latin,stade=bilanMigrationInterAnnuelle at stades@data$std_libelle,DC,resum=NULL)
+ funtable(tableau=dat,
+ time.sequence=tmp,
+ taxon=bilanMigrationInterAnnuelle at taxons@data$tax_nom_latin,
+ stade=bilanMigrationInterAnnuelle at stades@data$std_libelle,
+ DC,
+ resum=NULL)
}
Modified: branch0.5/stacomir/R/BilanMigrationMult.r
===================================================================
--- branch0.5/stacomir/R/BilanMigrationMult.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/BilanMigrationMult.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -121,13 +121,13 @@
#' command line interface for BilanMigrationMult class
#'
-#' The load method fills in the data slot for RefDC, RefTaxon, RefStades and then
-#' uses the load methods of these object to "select" the data.
+#' The choice_c method fills in the data slot for RefDC, RefTaxon, RefStades and then
+#' uses the choice_c methods of these object to "select" the data.
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
#' @export
#' @examples
#' \dontrun{
-#' bilanMigrationMult=load(bilanMigrationMult,
+#' bilanMigrationMult=choice_c(bilanMigrationMult,
#' dc=c(5,6,12),
#' taxons=c("Anguilla anguilla"),
#' stades=c("AGG","AGJ","CIV"),datedebut="2011-01-01",datefin="2011-12-31")
@@ -136,20 +136,20 @@
#' hbilanMigrationMultgraph2()
#' hbilanMigrationMultgraph3()
#' }
-setMethod("load",signature=signature("BilanMigrationMult"),definition=function(object,dc,taxons,stades,datedebut,datefin,...){
+setMethod("choice_c",signature=signature("BilanMigrationMult"),definition=function(object,dc,taxons,stades,datedebut,datefin,...){
bilanMigrationMult<-object
fonctionnementDC=new("BilanFonctionnementDC")
# appel ici pour pouvoir utiliser les fonctions graphiques associees sur fonctionnement du DC
assign("fonctionnementDC",fonctionnementDC,envir = envir_stacomi)
bilanMigrationMult at dc=charge(bilanMigrationMult at dc)
# loads and verifies the dc
- bilanMigrationMult at dc<-load(object=bilanMigrationMult at dc,dc)
+ bilanMigrationMult at dc<-choice_c(object=bilanMigrationMult at dc,dc)
# only taxa present in the bilanMigration are used
bilanMigrationMult at taxons<-charge_avec_filtre(object=bilanMigrationMult at taxons,bilanMigrationMult at dc@dc_selectionne)
- bilanMigrationMult at taxons<-load(bilanMigrationMult at taxons,taxons)
+ bilanMigrationMult at taxons<-choice_c(bilanMigrationMult at taxons,taxons)
bilanMigrationMult at stades<-charge_avec_filtre(object=bilanMigrationMult at stades,bilanMigrationMult at dc@dc_selectionne,bilanMigrationMult at taxons@data$tax_code)
- bilanMigrationMult at stades<-load(bilanMigrationMult at stades,stades)
- bilanMigrationMult at pasDeTemps<-load(bilanMigrationMult at pasDeTemps,datedebut,datefin)
+ bilanMigrationMult at stades<-choice_c(bilanMigrationMult at stades,stades)
+ bilanMigrationMult at pasDeTemps<-choice_c(bilanMigrationMult at pasDeTemps,datedebut,datefin)
assign("bilanMigrationMult",bilanMigrationMult,envir = envir_stacomi)
return(bilanMigrationMult)
})
@@ -368,7 +368,7 @@
#----------------------------------
# bilan migration avec poids (civelles
#-----------------------------------------
- grDevice::X11()
+ grDevices::X11()
fungraph_civelle(bilanMigration=bilanMigrationMult,
table=data_without_hole,
duree=bilanMigrationMult at time.sequence,
@@ -379,7 +379,7 @@
#----------------------------------
# bilan migration standard
#-----------------------------------------
- grDevice::X11()
+ grDevices::X11()
fungraph(bilanMigration=bilanMigrationMult,
tableau=data_without_hole,
duree=bilanMigrationMult at time.sequence,
@@ -627,8 +627,11 @@
data_without_hole$EXPERT[is.na(data_without_hole$EXPERT)]<-0
data_without_hole$PONCTUEL[is.na(data_without_hole$PONCTUEL)]<-0
- resum=funstat(tableau=data_without_hole,duree=bilanMigrationMult at time.sequence,taxon,stade,DC)
- funtable(tableau=data_without_hole,duree=bilanMigrationMult at time.sequence,taxon,stade,DC,resum)
+ resum=funstat(tableau=data_without_hole,
+ time.sequence=bilanMigrationMult at time.sequence,taxon,stade,DC)
+ funtable(tableau=data_without_hole,
+ time.sequence=bilanMigrationMult at time.sequence,
+ taxon,stade,DC,resum)
}
}
@@ -661,7 +664,7 @@
#' @export
setMethod("print",signature=signature("BilanMigrationMult"),definition=function(x,...){
sortie1<-"bilanMigrationMult=new(bilanMigrationMult)\n"
- sortie2<-stringr::str_c("bilanMigrationMult=load(bilanMigrationMult,",
+ sortie2<-stringr::str_c("bilanMigrationMult=choice_c(bilanMigrationMult,",
"dc=c(",stringr::str_c(x at dc@dc_selectionne,collapse=","),"),",
"taxons=c(",stringr::str_c(shQuote(x at taxons@data$tax_nom_latin),collapse=","),"),",
"stades=c(",stringr::str_c(shQuote(x at stades@data$std_code),collapse=","),"),",
Modified: branch0.5/stacomir/R/BilanMigrationPar.r
===================================================================
--- branch0.5/stacomir/R/BilanMigrationPar.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/BilanMigrationPar.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -113,11 +113,11 @@
funout(get("msg",envir=envir_stacomi)$BilanMigration.1,arret=FALSE)
warning(get("msg",envir=envir_stacomi)$BilanMigration.1)
}
- if (exists("refchoix",envir_stacomi)){
- bilanMigrationPar at echantillon<-get("refchoix",envir_stacomi)
+ if (exists("refchoice",envir_stacomi)){
+ bilanMigrationPar at echantillon<-get("refchoice",envir_stacomi)
} else
{
- bilanMigrationPar at echantillon@listechoix<-"avec"
+ bilanMigrationPar at echantillon@listechoice<-"avec"
bilanMigrationPar at echantillon@selected<-as.integer(1)
}
if (exists("refparquan",envir_stacomi)){
@@ -164,36 +164,36 @@
# graphiques (a affiner pb si autre chose que journalier)
# pour sauvegarder sous excel
})
-#' le handler appelle la methode generique graphe sur l'object choix=1
+#' le handler appelle la methode generique graphe sur l'object choice=1
#'
#' @param h, passed by the handler
hbilanMigrationPargraph = function(h,...) {
if (exists("bilanMigrationPar",envir_stacomi)) {
bilanMigrationPar<-get("bilanMigrationPar",envir_stacomi)
- plot(bilanMigrationPar,choix=1)
+ plot(bilanMigrationPar,choice=1)
} else {
funout(get("msg",envir=envir_stacomi)$BilanMigrationPar.5,arret=TRUE)
}
}
-#' le handler appelle la methode generique graphe sur l'object choix=2
+#' le handler appelle la methode generique graphe sur l'object choice=2
#'
#' @param h, passed by the handler
hbilanMigrationPargraph2=function(h,...){
if (exists("bilanMigrationPar",envir_stacomi)) {
bilanMigrationPar<-get("bilanMigrationPar",envir_stacomi)
- plot(bilanMigrationPar,choix=2)
+ plot(bilanMigrationPar,choice=2)
} else {
funout(get("msg",envir=envir_stacomi)$BilanMigrationPar.5,arret=TRUE)
}
}
-#' This handler calls the generic method graphe on object choix 3
+#' This handler calls the generic method graphe on object choice 3
#'
#'
#' @param h, passed by
hbilanMigrationParstat=function(h,...){
if (exists("bilanMigrationPar",envir_stacomi)) {
bilanMigrationPar<-get("bilanMigrationPar",envir_stacomi)
- plot(bilanMigrationPar,choix=3)
+ plot(bilanMigrationPar,choice=3)
} else {
funout(get("msg",envir=envir_stacomi)$BilanMigrationPar.5,arret=TRUE)
}
@@ -203,9 +203,9 @@
#'
#' @param x An object of class BilanMigrationPar
#' @param y null to conform to generic plot method
-#' @param choix 1=barplot, 2=xyplot, 3=summary table
+#' @param choice 1=barplot, 2=xyplot, 3=summary table
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
-setMethod("plot",signature=signature("BilanMigrationPar"),definition=function(x,y=null,choix=1,...){
+setMethod("plot",signature=signature("BilanMigrationPar"),definition=function(x,y=null,choice=1,...){
###########################
bilanMigrationPar<-x # ne pas passer dessus en debug manuel
##########################
@@ -229,23 +229,23 @@
mb=funtraitementdate(data=mb,nom_coldt="Date")
# transformation du tableau de donnees
- if (choix==1) {
+ if (choice==1) {
g<-ggplot(mb)
g<-g+geom_bar(aes(x=mois,y=sommes,fill=variable),stat='identity',stack=TRUE)
assign("g",g,envir_stacomi)
funout(get("msg",envir=envir_stacomi)$BilanMigrationPar.6)
print(g)
- } #end choix1
- if (choix==2) {
+ } #end choice1
+ if (choice==2) {
g<-ggplot(mb)
g<-g+geom_point(aes(x=Date,y=sommes,col=variable),stat='identity',stack=TRUE)
assign("g",g,envir_stacomi)
funout(get("msg",envir=envir_stacomi)$BilanMigrationPar.6)
print(g)
- } #end choix2
- if (choix==3) {
+ } #end choice2
+ if (choice==3) {
table=round(tapply(mb$somme,list(mb$mois,mb$variable),sum),1)
table=as.data.frame(table)
table[,"total"]<-rowSums(table)
@@ -258,7 +258,7 @@
path1=file.path(path.expand(get("datawd",envir=envir_stacomi)),paste(nmvarqan,"_journalier_",nomdc,"_",bilanMigrationPar at taxons@data$tax_nom_commun,"_",bilanMigrationPar at stades@data$std_libelle,"_",annee,".csv",sep=""),fsep ="\\")
write.table(bilanMigrationPar at data,file=path1,row.names=FALSE,col.names=TRUE,sep=";")
funout(paste(get("msg",envir=envir_stacomi)$BilanMigrationPar.7,path1,"\n"))
- } # end choix3
+ } # end choice3
})
Modified: branch0.5/stacomir/R/Bilan_poids_moyen.r
===================================================================
--- branch0.5/stacomir/R/Bilan_poids_moyen.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/Bilan_poids_moyen.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -92,7 +92,7 @@
" FROM ",get("sch",envir=envir_stacomi),"vue_lot_ope_car_qan",sep="")
requete at and=paste(" AND ope_dic_identifiant=",object at dc@dc_selectionne,
" AND std_libelle='civelle'",
- ifelse(object at liste@listechoix=="tous", "",paste(" AND lot_effectif", object at liste@listechoix)),
+ ifelse(object at liste@listechoice=="tous", "",paste(" AND lot_effectif", object at liste@listechoice)),
" AND upper(car_methode_obtention::text) = 'MESURE'::text",
" AND car_par_code='A111'",sep="")
requete<-stacomirtools::connect(requete)
@@ -194,7 +194,7 @@
funout("object p assigned to envir_stacomi")
}
hcoe=function(h,...){
- type_poids= switch (bilan_poids_moyen at liste@listechoix,
+ type_poids= switch (bilan_poids_moyen at liste@listechoice,
">1"=get("msg",envir_stacomi)$Bilan_poids_moyen.5,
"=1"=get("msg",envir_stacomi)$Bilan_poids_moyen.6,
"tous"=get("msg",envir_stacomi)$Bilan_poids_moyen.7)
@@ -219,8 +219,8 @@
jour=as.numeric(strftime(as.POSIXlt(seq),format="%j"))
coe=data.frame("date"=seq,"poids_moyen"=NA,"effectif"=NA,"lot"=NA,"jour"=jour)
- fm <- nls(formula=poids_moyen ~ a*cos(2*pi*(jour-T)/365)+b ,data=don,start=list(a=10,T=30,b=10))
- pred<-predict(fm, newdata=coe)
+ fm <- stats::nls(formula=poids_moyen ~ a*cos(2*pi*(jour-T)/365)+b ,data=don,start=list(a=10,T=30,b=10))
+ pred<-stats::predict(fm, newdata=coe)
com=paste(get("msg",envir_stacomi)$Bilan_poids_moyen.13,paste("a=",round(coef(fm),2)[1],"T=",round(coef(fm),2)[2],"b=",round(coef(fm),2)[3],collapse=""))
if (h$action=="reg" ){ # bouton reg clique
hcoe(h)
@@ -238,7 +238,7 @@
"coe_commentaires"=com)
fileout= paste("C:/base/","import_coe",bilan_poids_moyen at anneedebut@annee_selectionnee,bilan_poids_moyen at anneefin@annee_selectionnee,".csv",sep="")
#attention ecrit dans C:/base....
- write.table(import_coe,file=fileout, row.names = FALSE,sep=";")
+ utils::write.table(import_coe,file=fileout, row.names = FALSE,sep=";")
assign("import_coe",import_coe,envir=envir_stacomi)
funout(get("msg",envir_stacomi)$Bilan_poids_moyen.14)
funout(paste(get("msg",envir_stacomi)$Bilan_poids_moyen.15,fileout,"\n"))
Modified: branch0.5/stacomir/R/Bilan_stades_pigm.r
===================================================================
--- branch0.5/stacomir/R/Bilan_stades_pigm.r 2016-08-19 07:58:03 UTC (rev 159)
+++ branch0.5/stacomir/R/Bilan_stades_pigm.r 2016-08-19 19:34:11 UTC (rev 160)
@@ -101,11 +101,11 @@
if (nrow (requete at query)>0) {
stades<-stacomirtools::killfactor(requete at query)
- choixpere=c("lotpere","date")
+ choicepere=c("lotpere","date")
funout(paste("Attention il peut y avoir plusieurs lots a la meme date, et certains stades sont fait sans lotpere (ex taille-poids-stade)\n"))
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/stacomir -r 160
More information about the Stacomir-commits
mailing list