[Stacomir-commits] r293 - in pkg/stacomir: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Feb 12 20:57:52 CET 2017
Author: briand
Date: 2017-02-12 20:57:52 +0100 (Sun, 12 Feb 2017)
New Revision: 293
Modified:
pkg/stacomir/NAMESPACE
pkg/stacomir/R/BilanAgedemer.r
pkg/stacomir/R/BilanArgentee.r
pkg/stacomir/R/Bilan_poids_moyen.r
pkg/stacomir/R/interface_BilanFonctionnementDC.r
pkg/stacomir/R/stacomi.r
pkg/stacomir/man/envir_stacomi.Rd
pkg/stacomir/man/f_stade_Durif.Rd
pkg/stacomir/man/model-Bilan_poids_moyen-method.Rd
Log:
Other changes for R check
Modified: pkg/stacomir/NAMESPACE
===================================================================
--- pkg/stacomir/NAMESPACE 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/NAMESPACE 2017-02-12 19:57:52 UTC (rev 293)
@@ -114,6 +114,7 @@
importFrom(mgcv,gam)
importFrom(reshape2,dcast)
importFrom(reshape2,melt)
+importFrom(stats,AIC)
importFrom(stats,as.formula)
importFrom(stats,coef)
importFrom(stats,coefficients)
Modified: pkg/stacomir/R/BilanAgedemer.r
===================================================================
--- pkg/stacomir/R/BilanAgedemer.r 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/R/BilanAgedemer.r 2017-02-12 19:57:52 UTC (rev 293)
@@ -524,19 +524,3 @@
}
-#' Function to calculate the stages from Durif
-#'
-#' @param data A dataset with columns BL, W, Dv, Dh, FL corresponding to body length (mm),
-#' Weight (g), vertical eye diameter (mm), vertical eye diameter (mm), and pectoral fin length (mm)
-#' @author Laurent Beaulaton \email{laurent.beaulaton"at"onema.fr}
-#' @export
-f_stade_Durif = function(data){
- data(coef_Durif)
- 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/BilanArgentee.r
===================================================================
--- pkg/stacomir/R/BilanArgentee.r 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/R/BilanArgentee.r 2017-02-12 19:57:52 UTC (rev 293)
@@ -727,7 +727,8 @@
#' @author Laurent Beaulaton \email{laurent.beaulaton"at"onema.fr}
#' @export
f_stade_Durif = function(data){
- data(coef_Durif)
+ # see section Good Practise in ? data
+ data(coef_Durif,envir = environment())
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")
Modified: pkg/stacomir/R/Bilan_poids_moyen.r
===================================================================
--- pkg/stacomir/R/Bilan_poids_moyen.r 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/R/Bilan_poids_moyen.r 2017-02-12 19:57:52 UTC (rev 293)
@@ -419,7 +419,7 @@
com="model seasonal1 = gam(w~s(yday,bs='cc')+s(time), knots = list(yday = c(1, 365)))"
} else if (model.type=="seasonal2"){
#########################################################
- # seasonal effects with a continuous sine-cosine wave,. The formula for this is ‘sin(omegavt) + cos(omegavt)’, where vt is the time index variable
+ # seasonal effects with a continuous sine-cosine wave,. The formula for this is 'sin(omegavt) + cos(omegavt)', where vt is the time index variable
# omega is a constant that describes how the index variable relates to the full period (here, 2pi/365=0.0172).
############################################################
g2 = mgcv::gam(w~cos(0.0172*doy)+sin(0.0172*doy)+s(time),data=don)
@@ -490,8 +490,8 @@
"coe_tax_code"='2038',
"coe_std_code"='CIV',
"coe_qte_code"=1,
- "coe_date_debut"=Hmisc::round.POSIXt(predata$date,units="days"),
- "coe_date_fin"=Hmisc::round.POSIXt(predata$date,units="days")+as.difftime(1,units="days"),
+ "coe_date_debut"=Hmisc::round.POSIXt(predata$date,digits="days"),
+ "coe_date_fin"=Hmisc::round.POSIXt(predata$date,digits="days")+as.difftime(1,units="days"),
"coe_valeur_coefficient"=1/predata$pred_weight,
"coe_commentaires"=com)
fileout= paste("C:/base/","import_coe",bilPM at anneedebut@annee_selectionnee,bilPM at anneefin@annee_selectionnee,".csv",sep="")
Modified: pkg/stacomir/R/interface_BilanFonctionnementDC.r
===================================================================
--- pkg/stacomir/R/interface_BilanFonctionnementDC.r 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/R/interface_BilanFonctionnementDC.r 2017-02-12 19:57:52 UTC (rev 293)
@@ -41,7 +41,7 @@
icon="barplot",
handler=funbarchart1DC,
tooltip=gettext("Another monthly graph",domain="R-stacomiR"))
- aBox=gWidgets::gaction(label=getext("box"),
+ aBox=gWidgets::gaction(label=gettext("box"),
icon="graph2",
handler=funboxDC,
tooltip=gettext("Boxplot",domain="R-stacomiR"))
@@ -53,7 +53,7 @@
icon="close",
handler=quitte,
tooltip=gettext("Exit",domain="R-stacomiR"))
- aOut=gWidgets::gaction(label=gettex("code"),
+ aOut=gWidgets::gaction(label=gettext("code"),
handler=houtDC,
icon="gtk-info",
tooltip=gettext("code",domain="R-stacomiR"))
Modified: pkg/stacomir/R/stacomi.r
===================================================================
--- pkg/stacomir/R/stacomi.r 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/R/stacomi.r 2017-02-12 19:57:52 UTC (rev 293)
@@ -297,6 +297,7 @@
#' @importFrom utils select.list write.table data
#' @importFrom stats ftable
#' @importFrom stats xtabs
+#' @importFrom stats AIC
#' @importFrom grDevices dev.new
#' @importFrom stats sd
#' @importFrom reshape2 dcast
@@ -504,7 +505,9 @@
'dev_libelle','ope_date_fin','bilan_stades_pigm','ope_date_debut','p','g','poids_moyen',
'taxon_stades','jour',"valeur","mintab","maxtab","moyenne","jour","total_annuel",
"taxon_stades","time.sequence","sum","variable","duree","Hdeb","Hfin","per_tar_code",
- "per_etat_fonctionnement","std_libelle","sumduree","dc","stade","taxon","stage","ouv"))
+ "per_etat_fonctionnement","std_libelle","sumduree","dc","stade","taxon","stage","ouv",
+ "Q0","Q100","Q5","Q50","Q95","age","bjo_annee","bjo_labelquantite","bjo_valeur","doy",
+ "pred_weight","pred_weight_lwr","pred_weight_upr","total","w","year"))
# variable used by dplyr
utils::globalVariables(c("n0","newid","xmin","xmax"))
Modified: pkg/stacomir/man/envir_stacomi.Rd
===================================================================
--- pkg/stacomir/man/envir_stacomi.Rd 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/man/envir_stacomi.Rd 2017-02-12 19:57:52 UTC (rev 293)
@@ -5,7 +5,7 @@
\alias{envir_stacomi}
\title{Environment where most objects from the package are stored and then loaded
by the charge method}
-\format{An object of class \code{environment} of length 4.}
+\format{An object of class \code{environment} of length 9.}
\usage{
envir_stacomi
Modified: pkg/stacomir/man/f_stade_Durif.Rd
===================================================================
--- pkg/stacomir/man/f_stade_Durif.Rd 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/man/f_stade_Durif.Rd 2017-02-12 19:57:52 UTC (rev 293)
@@ -1,28 +1,19 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/BilanAgedemer.r, R/BilanArgentee.r
+% Please edit documentation in R/BilanArgentee.r
\name{f_stade_Durif}
\alias{f_stade_Durif}
\title{Function to calculate the stages from Durif}
\usage{
f_stade_Durif(data)
-
-f_stade_Durif(data)
}
\arguments{
\item{data}{A dataset with columns BL, W, Dv, Dh, FL corresponding to body length (mm),
Weight (g), vertical eye diameter (mm), vertical eye diameter (mm), and pectoral fin length (mm)}
-
-\item{data}{A dataset with columns BL, W, Dv, Dh, FL corresponding to body length (mm),
-Weight (g), vertical eye diameter (mm), vertical eye diameter (mm), and pectoral fin length (mm)}
}
\description{
Function to calculate the stages from Durif
-
-Function to calculate the stages from Durif
}
\author{
Laurent Beaulaton \email{laurent.beaulaton"at"onema.fr}
-
-Laurent Beaulaton \email{laurent.beaulaton"at"onema.fr}
}
Modified: pkg/stacomir/man/model-Bilan_poids_moyen-method.Rd
===================================================================
--- pkg/stacomir/man/model-Bilan_poids_moyen-method.Rd 2017-02-12 19:18:28 UTC (rev 292)
+++ pkg/stacomir/man/model-Bilan_poids_moyen-method.Rd 2017-02-12 19:57:52 UTC (rev 293)
@@ -13,29 +13,6 @@
}
\arguments{
\item{object}{An object of class \link{Bilan_pois_moyen-class}}
-
-\item{model.type}{default "seasonal", "seasonal1","seasonal2","manual".
-\itemize{
- \item{model.type="seasonal". The simplest model uses a seasonal variation, it is
- fitted with a sine wave curve allowing a cyclic variation
- w ~ a*cos(2*pi*(doy-T)/365)+b with a period T. The julian time d0 used is this model is set
- at zero 1st of November d = d + d0; d0 = 305.}
- \item{model.type="seasonal1". A time component is introduced in the model, which allows
- for a long term variation along with the seasonal variation. This long term variation is
- is fitted with a gam, the time variable is set at zero at the beginning of the first day of observed values.
- The seasonal variation is modeled on the same modified julian time as model.type="seasonal"
- but here we use a cyclic cubic spline cc, which allows to return at the value of d0=0 at d=365.
- This model was considered as the best to model size variations by Diaz & Briand in prep. but using a large set of values
- over years.}
- \item{model.type="seasonal2". The seasonal trend in the previous model is now modelled with a sine
- curve similar to the sine curve used in seasonal. The formula for this is ‘sin(ωvt) + cos(ωvt)’,
- where vt is the time index variable ω is a constant that describes how the index variable relates to the full period
- (here, 2π/365=0.0172). the model is written as following w~cos(0.0172*doy)+sin(0.0172*doy)+s(time).}
- \item{model.type="manual", The dataset don (the raw data), coe (the coefficients already present in the
- database, and newcoe the dataset to make the predictions from, are written to the environment envir_stacomi.
- please see example for further description on how to fit your own model, build the table of coefficients,
- and write it to the database.}
-}}
}
\description{
model method for Bilan_poids_moyen'
More information about the Stacomir-commits
mailing list