[Stacomir-commits] r242 - in pkg/stacomir: R data inst/config inst/examples
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Dec 21 22:47:26 CET 2016
Author: briand
Date: 2016-12-21 22:47:25 +0100 (Wed, 21 Dec 2016)
New Revision: 242
Modified:
pkg/stacomir/R/BilanAnnuels.r
pkg/stacomir/R/BilanArgentee.r
pkg/stacomir/R/RefListe.r
pkg/stacomir/R/create_generic.r
pkg/stacomir/data/msg.rda
pkg/stacomir/inst/config/stacomi_manual_launch.r
pkg/stacomir/inst/examples/bilanArgentee_example.R
Log:
Modified: pkg/stacomir/R/BilanAnnuels.r
===================================================================
--- pkg/stacomir/R/BilanAnnuels.r 2016-12-19 10:51:35 UTC (rev 241)
+++ pkg/stacomir/R/BilanAnnuels.r 2016-12-21 21:47:25 UTC (rev 242)
@@ -122,7 +122,7 @@
#' @param anneedebut The starting the first year, passed as charcter or integer
#' @param anneefin the finishing year
#' @param silent Boolean, if TRUE, information messages are not displayed
-#' @return An object of class \link{BilanMigrationInterAnnuelle-class}
+#' @return An object of class \link{BilanAnnuels-class}
#' The choice_c method fills in the data slot for classes \link{RefDC-class}, \link{RefTaxon-class}, \link{RefStades-class} and two slots of \link{RefAnnee-class}
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
#' @export
Modified: pkg/stacomir/R/BilanArgentee.r
===================================================================
--- pkg/stacomir/R/BilanArgentee.r 2016-12-19 10:51:35 UTC (rev 241)
+++ pkg/stacomir/R/BilanArgentee.r 2016-12-21 21:47:25 UTC (rev 242)
@@ -721,6 +721,7 @@
stopifnot(colnames(data)==c("BL","W","Dv","Dh","FL"))
data<-cbind(1,data[,c(1,2,5)],rowMeans(data[,c("Dv","Dh")],na.rm=TRUE))
colnames(data)<-c("Constant","BL","W","FL","MD")
+ data<-data[,c(1,2,3,5,4)]
indices<-data%*%coef_Durif
return(unlist(apply(indices,1,function(X)ifelse(is.na(X[1]),NA,names(which.max(X))))))
}
Modified: pkg/stacomir/R/RefListe.r
===================================================================
--- pkg/stacomir/R/RefListe.r 2016-12-19 10:51:35 UTC (rev 241)
+++ pkg/stacomir/R/RefListe.r 2016-12-21 21:47:25 UTC (rev 242)
@@ -16,13 +16,13 @@
#' @keywords classes
#' @family Referential objects
-setClass(Class="RefListe",representation= representation(listechoice="character",label="character"))
+setClass(Class="RefListe",representation= representation(listechoice="character",selectedvalue="character",label="character"))
#' Loading method for Refliste referential objects
#' @return An object of class RefListe
#' @param object An object of class \link{RefListe-class}
-#' @param vecteur A character vector
+#' @param listechoice A character vector setting the possible values in which the user can select
#' @param label A label for Refliste
#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
#' @examples
@@ -30,8 +30,8 @@
#' object=new("RefListe")
#' charge(object)
#' }
-setMethod("charge",signature=signature("RefListe"),definition=function(object,vecteur,label) {
- object at listechoice=vecteur
+setMethod("charge",signature=signature("RefListe"),definition=function(object,listechoice,label) {
+ object at listechoice=listechoice
object at label=label
return(object)
})
@@ -45,22 +45,45 @@
#' object=new("RefListe")
#' win=gwindow()
#' group=ggroup(container=win,horizontal=FALSE)
-#' object<-charge(object)
+#' object<-charge(object,vecteur=c("choice1","choice2"),label="please choose")
#' choice(object)
#' }
setMethod("choice",signature=signature("RefListe"),definition=function(object,is.enabled=TRUE) {
hlist=function(h,...){
- valeurchoisie=svalue(choice)
- object at listechoice<-object at listechoice[list_libelle%in%valeurchoisie]
- #dispose(car)
- assign("refliste",object,envir_stacomi)
- funout(paste(object at label,"\n"))
- }
- frame_list<<-gframe(object at label)
- # TODO a modifier en assign() si je dois passer plusieurs listes puis les supprimer, il faudra alors detruire les listes par leur nom
- add(group,frame_list)
- list_libelle=fun_char_spe(object at listechoice)
- choice=gdroplist(items=list_libelle,container=frame_list,handler=hlist)
- enabled(frame_list)<-is.enabled
- gbutton("OK", container=frame_list,handler=hlist)
- })
+ valeurchoisie=svalue(choice)
+ object at listechoice<-object at listechoice[list_libelle%in%valeurchoisie]
+ assign("refliste",object,envir_stacomi)
+ funout(paste(object at label,"\n"))
+ }
+ frame_list<<-gframe(object at label)
+ add(group,frame_list)
+ list_libelle=fun_char_spe(object at listechoice)
+ choice=gdroplist(items=list_libelle,container=frame_list,handler=hlist)
+ enabled(frame_list)<-is.enabled
+ gbutton("OK", container=frame_list,handler=hlist)
+ })
+
+
+#' Choice_c method for RefListe referential objects
+#' @param object An object of class \link{RefListe-class}
+#' @note the choice method assigns an object of class refList named refListe in the environment envir_stacomi
+#' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
+#' @examples
+#' \dontrun{
+#' object=new("RefListe")
+#' object<-charge(object,vecteur=c("1","2"),label="please choose")
+#' object<-choice_c(object)
+#' }
+setMethod("choice_c",signature=signature("RefListe"),definition=function(object,selectedvalue) {
+ if (length(selectedvalue)>1) stop("valeurchoisie should be a vector of length 1")
+ if (class (selectedvalue)=="numeric") selectedvalue<-as.character(selectedvalue)
+ # the charge method must be performed before
+
+ if ( !selectedvalue %in% object at listechoice ) {
+ stop(stringr::str_c("The selected valeur,",selectedvalue," not in the list of possible values :",
+ stringr::str_c(object at listechoice,collapse=",")))
+ } else {
+ object at selectedvalue<-selectedvalue
+ }
+ return(object)
+ })
Modified: pkg/stacomir/R/create_generic.r
===================================================================
--- pkg/stacomir/R/create_generic.r 2016-12-19 10:51:35 UTC (rev 241)
+++ pkg/stacomir/R/create_generic.r 2016-12-21 21:47:25 UTC (rev 242)
@@ -31,6 +31,11 @@
#' @param ... Additional parms
#' @author cedric.briand
setGeneric("plot",def=function(x,y,...) standardGeneric("plot"))
+#' Generic for prediction
+#' @param object Object
+#' @param ... Additional parms
+#' @author cedric.briand
+setGeneric("predict",def=function(object,...) standardGeneric("predict"))
#' Generic method to load additional data
#' @param object Object
#' @param ... Additional parms
Modified: pkg/stacomir/data/msg.rda
===================================================================
(Binary files differ)
Modified: pkg/stacomir/inst/config/stacomi_manual_launch.r
===================================================================
--- pkg/stacomir/inst/config/stacomi_manual_launch.r 2016-12-19 10:51:35 UTC (rev 241)
+++ pkg/stacomir/inst/config/stacomi_manual_launch.r 2016-12-21 21:47:25 UTC (rev 242)
@@ -100,6 +100,6 @@
# interface_BilanEspeces dans BilanEspeces
setwd("F:/workspace/stacomir/pkg/stacomir")
data("msg")
- stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
+stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
Modified: pkg/stacomir/inst/examples/bilanArgentee_example.R
===================================================================
--- pkg/stacomir/inst/examples/bilanArgentee_example.R 2016-12-19 10:51:35 UTC (rev 241)
+++ pkg/stacomir/inst/examples/bilanArgentee_example.R 2016-12-21 21:47:25 UTC (rev 242)
@@ -2,7 +2,7 @@
# launching stacomi without selecting the scheme or interface
stacomi(gr_interface=FALSE,
login_window=FALSE,
- database_expected=FALSE)
+ database_expected=TRUE)
# the following script will load data from the two Anguillere monitored in the Somme
\dontrun{
@@ -33,7 +33,6 @@
plot(bilanArg, plot.type=1)
# number per month or year and Durif's stage (year if number of dc >1)
-
plot(bilanArg, plot.type=2)
# plot showing fulton's coefficient, and size weight graphs
@@ -44,6 +43,6 @@
plot(bilanArg, plot.type=3)
# get a list of summary data and print output to screen
-plot(bilanArg, plot.type=3)
+plot(bilanArg, plot.type=4)
# print a summary statistic, and save the output in a list for later use
stats<-summary(bilanArg)
\ No newline at end of file
More information about the Stacomir-commits
mailing list