Skip to content

Commit

Permalink
after check
Browse files Browse the repository at this point in the history
  • Loading branch information
laurieKell committed Apr 9, 2018
1 parent 0b6bf75 commit 7dacebd
Show file tree
Hide file tree
Showing 68 changed files with 138 additions and 60 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
Expand Up @@ -14,14 +14,13 @@ Description: Many studies have shown the relationships between life history
LazyData: true
License: GPL (>= 2)
Depends:
R(>= 3.1),
R(>= 3.1),
FLCore (>= 2.6),
Imports:
FLBRP,
methods,
popbio,
plyr,
reshape
plyr
Suggests:
ggplotFL (>= 2.5),
testthat,
Expand Down Expand Up @@ -79,4 +78,6 @@ Collate:
getScriptPath.R
pMeasure.R
sim.R
knifeEdgeMsy.R
netSel.r
RoxygenNote: 6.0.1
8 changes: 4 additions & 4 deletions NAMESPACE
Expand Up @@ -14,6 +14,7 @@ exportMethods(gascuel)
exportMethods(gislason)
exportMethods(gompertz)
exportMethods(griffiths)
exportMethods(grwdd)
exportMethods(jensen)
exportMethods(jensen2)
exportMethods(knife)
Expand All @@ -34,17 +35,16 @@ exportMethods(richards)
exportMethods(rikhter)
exportMethods(rikhter2)
exportMethods(rnoise)
exportMethods(rlnoise)
exportMethods(rod)
exportMethods(roff)
exportMethods(sigmoid)
exportMethods(sv)
exportMethods(vonB)
exportMethods(wt2len)
import(plyr)
import(reshape)
import(FLCore)
import(methods)
importFrom(FLBRP, refpts, "refpts<-", brp, "fbar<-", FLBRP)
importFrom(FLBRP,refpts)
importFrom(methods,is)
importFrom(plyr,.)
importFrom(plyr,ddply)
importFrom(popbio,lambda)
2 changes: 1 addition & 1 deletion R/Rmd/lhPar.R
Expand Up @@ -21,7 +21,7 @@
#'
#' @export
#'
#' @seealso \code{\link{r}}, \code{\link{loptAge}}, \code{\link{lhRef}}, \code{\link{lhPar}}, \code{\link{lhEql}}
#' @seealso \code{\link{loptAge}}, \code{\link{lhRef}}, \code{\link{lhPar}}, \code{\link{lhEql}}
#'
#' @import methods
#' @docType methods
Expand Down
28 changes: 28 additions & 0 deletions R/data.R
Expand Up @@ -41,4 +41,32 @@ NULL
#' }
#' @name teleost
#'
NULL

#' wklife
#'
#' A dataset containing life history parameters for a range of teleost species
#'
#' @docType data
#'
#' @seealso \code{\link{teleost}}
#'
#' @format A data frame with 15 rows (i.e. species) and 13 variables:
#' \describe{
#' \item{species}{}
#' \item{name}{}
#' \item{area}{}
#' \item{stock}{}
#' \item{sex}{}
#' \item{a}{scaling factor of the length weight relationship}
#' \item{b}{exponent of the length weight relationship}
#' \item{linf}{asymptotic length of the Von Bertalanffy growth equation}
#' \item{k}{rate at which length reaches linf}
#' \item{t0}{adjusts the growth equation for the initial size at birth}
#' \item{lmax}{asymptotic length of the Von Bertalanffy growth equation}
#' \item{l50}{length at which 50\% are mature}
#' \item{a50}{age at which 50\% are mature}
#' }
#' @name wklife
#'
NULL
4 changes: 2 additions & 2 deletions R/elasticity.R
Expand Up @@ -127,7 +127,7 @@ doIt=function(what,par,dynamic=FALSE,fbar=FLQuant(c(seq(0,.75,length.out=21),seq
par["M2"] =-par["M2"]
units(par)=unt

res=lh(par)
res=lhEql(par)

fbar(res)=fbar
res =brp(res)
Expand Down Expand Up @@ -175,7 +175,7 @@ cvIt=function(what,par,dynamic=FALSE,fbar=FLQuant(c(seq(0,.75,length.out=21),seq
func=function(x,par,fbar,dynamic=TRUE,what) {

par[] =x
res=lh(par)
res=lhEql(par)

fbar(res)=fbar
res =brp(res)
Expand Down
2 changes: 1 addition & 1 deletion R/generic.R
Expand Up @@ -5,7 +5,7 @@ utils::globalVariables(c("rbind.fill","data","FLBRP2biodyn","quantity","optimise
"dmns","rho","stk","aaply","maply","alply","laply","error",
"%^%","%*%","%-%","%+%","pow",
"FLPar",
"lh","fbar<-","FLBRP","brp","refpts","refpts<-","as",
"fbar<-","FLBRP","brp","refpts","refpts<-","as",
"computeRefpts","computeRefpts","catch.obs",
"fwdWindow","aaply","invGascuelFn","laply","lambda",
"asym","ddply",".","year","a","b","grad","ddply",".","x",'aaply',"invgompertzFn",
Expand Down
1 change: 1 addition & 0 deletions R/grw-dd.R
Expand Up @@ -29,6 +29,7 @@
#' @param params an \code{FLPar} with two values; i.e. a equal to M at unit mass and b a power term; defaults are a=0.3 and b=-0.288
#' @param scale reference
#' @param k rate of change in density dependence
#' @param fn function with growth model, with args age params
#' @param ... other arguments, such as scale, e.g. stock numbers now relative to a reference level, e.g. at virgin biomass and k steepness of relationship
#'
#' @aliases grwdd grwdd-method grwdd,FLQuant,FLPar-method
Expand Down
41 changes: 19 additions & 22 deletions R/len-index.R
@@ -1,25 +1,20 @@
# fn: no visible global function definition for ‘rmvnorm’
# fn: no visible binding for global variable ‘bin’
# fn: no visible binding for global variable ‘V1’
# ldex: no visible binding for global variable ‘bin’
# ldex: no visible binding for global variable ‘p’
# mseEMP: no visible binding for global variable ‘mp’
# mseSBT1: no visible binding for global variable ‘mp’
# power : <anonymous>: no visible global function definition for
# ‘powertrend’
# power : <anonymous>: no visible binding for global variable ‘R’
# power : <anonymous>: no visible binding for global variable ‘yrs’
# power: no visible binding for global variable ‘pse’
# power: no visible binding for global variable ‘increase’
# power : <anonymous>: no visible global function definition for
# ‘interpp’
# refs,FLStock : <anonymous>: no visible binding for global variable
# ‘regime’
# refs,FLStock: no visible binding for global variable ‘b.msy’
# refs,FLStock: no visible binding for global variable ‘b.current’
# spectra,FLStock: no visible global function definition for ‘spectraFLQ’
# Undefined global functions or variables:

utils::globalVariables(c("rmvnorm"))
utils::globalVariables(c("bin"))
utils::globalVariables(c("V1"))
utils::globalVariables(c("bin"))
utils::globalVariables(c("p"))
utils::globalVariables(c("mp"))
utils::globalVariables(c("mp"))
utils::globalVariables(c("powertrend"))
utils::globalVariables(c("R"))
utils::globalVariables(c("yrs"))
utils::globalVariables(c("pse"))
utils::globalVariables(c("increase"))
utils::globalVariables(c("interpp"))
utils::globalVariables(c("regime"))
utils::globalVariables(c("b.msy"))
utils::globalVariables(c("b.current"))
utils::globalVariables(c("spectraFLQ"))

fn=function(year,object,sigma,nsample=100) {
n =as.data.frame(stock.n(object)[,year]^(1/3),drop=TRUE)
Expand All @@ -36,6 +31,8 @@ fn=function(year,object,sigma,nsample=100) {
idx =transform(idx,p=V1/sum(V1))
idx}

utils::globalVariables(c("adply"))

fn2<-function(object,cv=0.3,nsample=100){

sigma=matrix(0, ncol=dim(m(object))[1],nrow=dim(m(object))[1])
Expand Down
4 changes: 2 additions & 2 deletions R/leslie.R
Expand Up @@ -8,15 +8,15 @@
#' @param numbers \code{boolean} numbers or biomass, numbers bt default
#' @param ... any other arguments
#'
#' @aliases leslie-method leslie,FLBRP-method
#' @aliases leslie leslie-method leslie,FLBRP-method
#'
#' @return \code{matrix}
#'
#' @export
#' @docType methods
#' @rdname leslie
#'
#' @seealso \code{\link{r}}, \code{\link{lhRef}}, \code{\link{lhPar}}, \code{\link{lhEql}}
#' @seealso \code{\link{lhRef}}, \code{\link{lhPar}}, \code{\link{lhEql}}
#'
#'
#' @examples
Expand Down
7 changes: 6 additions & 1 deletion R/lhPar.R
@@ -1,3 +1,8 @@
utils::globalVariables(c("dlply"))
utils::globalVariables(c("mlply"))
utils::globalVariables(c("cast"))


#' @title Generates life history parameters
#'
#' @description
Expand All @@ -21,7 +26,7 @@
#'
#' @export
#'
#' @seealso \code{\link{r}}, \code{\link{loptAge}}, \code{\link{lhRef}}, \code{\link{lhPar}}, \code{\link{lhEql}}
#' @seealso \code{\link{loptAge}}, \code{\link{lhRef}}, \code{\link{lhPar}}, \code{\link{lhEql}}
#'
#' @import methods
#' @docType methods
Expand Down
4 changes: 2 additions & 2 deletions R/lhRef.R
Expand Up @@ -153,9 +153,9 @@ tmp=d_ply(scen,.(juve,dome,steep,m,species), with, {
p["sr",]=ifelse(dome,5,5000)

if (m=="Gislason"){
eql=lh(p)
eql=lhEql(p)
}else{
eql=lh(p,m=function(params,length){
eql=lhEql(p,m=function(params,length){
length[]=params["l50"]
0.55*(length^-1.66)%*%(params["linf"]^1.44)%*%params["k"]})}

Expand Down
2 changes: 1 addition & 1 deletion R/lopt.R
Expand Up @@ -40,7 +40,7 @@ utils::globalVariables("growth")
setMethod("lopt", signature(params="FLPar"),
function(params,
m=function(length,params) exp(0.55)*(length^-1.61)%*%(params["linf"]^1.44)%*%params["k"],
growth=FLife:::vonB,
growth=vonB,
...){
dmns=dimnames(params)
dmns$params="lopt"
Expand Down
7 changes: 4 additions & 3 deletions R/m-dd.R
Expand Up @@ -25,14 +25,15 @@
#'
#' M=aL/(1+exp(-k(n-ref)))*wt^b;
#'
#' @param wt mass at which M is to be predicted
#' @param object mass at which M is to be predicted
#' @param params an \code{FLPar} with two values; i.e. a equal to M at unit mass and b a power term; defaults are a=0.3 and b=-0.288
#' @param scale reference
#' @param k rate of change in density dependence
#' @param ... other arguments, such as scale, e.g. stock numbers now relative to a reference level, e.g. at virgin biomass and k steepness of relationship
#' @param m function with mortality model, by default gisalson
#'
#' @aliases mdd mdd-method mdd,FLQuant,FLPar-method
#'
#' @param ... other arguments, such as scale, e.g. stock numbers now relative to a reference level, e.g. at virgin biomass and k steepness of relationship
#
#' @export
#' @docType methods
#' @rdname mdd
Expand Down
4 changes: 2 additions & 2 deletions R/mFn.R
Expand Up @@ -15,7 +15,7 @@
#' jensen jensen-method jensen,FLPar-method
#' jensen2 jensen2-method jensen2,FLPar-method
#' charnov charnov-method charnov,FLQuant,FLPar-method
#' petersen petersen-method petersen,FLPar-method
#' petersen petersen-method petersen,FLPar-method petersen,FLQuant,FLPar-method
#'
#' @return returns an object of \code{FLQuant}
#'
Expand Down Expand Up @@ -55,7 +55,7 @@
#'
#' Varing by length, weight or age
#'
#' @seealso \code{\link{gislason}}, \code{\link{lorenzen}}, \code{\link{chen}}
#' @seealso \code{\link{gislason}}, \code{\link{lorenzen}}
#'
#' @examples
#' \dontrun{
Expand Down
3 changes: 2 additions & 1 deletion R/powh.R
Expand Up @@ -80,7 +80,8 @@
#' \emph{ICLARM Conf. Proc}, pages 53--74, 1987.
#'
#' @aliases powh-method powh,numeric,numeric-method
#'
#' @importFrom plyr ddply .
#'
#' @export
#' @docType methods
#' @rdname powh
Expand Down
3 changes: 2 additions & 1 deletion R/refs.R
Expand Up @@ -18,7 +18,8 @@
#' the average recruitment.
#'
#' @param object \code{FLStock}
#'
#' @param ... other arguments
#' @aliases refs refs-method refs,FLStock-method
#' @return \code{data.frame}
#'
#' @export
Expand Down
3 changes: 2 additions & 1 deletion R/richards.R
Expand Up @@ -7,7 +7,8 @@
#' @param params \code{FLPar} object with parameters \code{linf}, \code{k} and \code{t0}
#' @param ... other arguments
#'
#' @aliases richards richards-method richards,FLPar,FLPar-method richards,FLQuant,FLPar-method richards,FLQuant,numeric-method richards,missing,FLPar-method richards,numeric,numeric-method
#' @aliases richards richards-method richards,FLPar,FLPar-method richards,FLQuant,FLPar-method richards,FLQuant,numeric-method richards,missing,FLPar-method richards,numeric,numeric-method #' richards numeric,FLPar-method

#'
#' @return Returns an object of same class as \code{age} e.g. \code{FLQuant}
#'
Expand Down
2 changes: 1 addition & 1 deletion R/sbt-mse.R
Expand Up @@ -164,7 +164,7 @@ if (FALSE){
par=lhPar(FLPar(linf=100))
eql=lhEql(par)
mou=as(eql,"FLStock")
mou=FLash::fwd(mou,f=fbar(eql)[,-1]/4,sr=eql)
mou=fwd(mou,f=fbar(eql)[,-1]/4,sr=eql)

srDev=rlnorm(100,FLQuant(rep(0,136)),0.3)

Expand Down
2 changes: 2 additions & 0 deletions R/spectra.R
@@ -1,3 +1,5 @@
utils::globalVariables(c("adply"))

setGeneric('spectra', function(object,...) standardGeneric('spectra'))

#Spectral analysis function
Expand Down
2 changes: 1 addition & 1 deletion R/stars.R
@@ -1,5 +1,5 @@

rodFn=function(data,year=NULL,plot=FALSE){
rodFn<-function(data,year=NULL,plot=FALSE){

if (is.null(year)) year=seq(length(data))

Expand Down
2 changes: 1 addition & 1 deletion R/vonB.R
Expand Up @@ -7,7 +7,7 @@
#' @param params \code{FLPar} object with parameters \code{linf}, \code{k} and \code{t0}
#' @param ... other arguments
#'
#' @aliases vonB vonB-method vonB,FLPar,FLPar-method vonB,FLQuant,FLPar-method vonB,FLQuant,numeric-method vonB,missing,FLPar-method vonB,numeric,numeric-method
#' @aliases vonB vonB-method vonB,FLPar,FLPar-method vonB,FLQuant,FLPar-method vonB,FLQuant,numeric-method vonB,missing,FLPar-method vonB,numeric,numeric-method vonB,numeric,FLPar-method
#'
#' @return Returns an object of same class as \code{age} e.g. \code{FLQuant}
#'
Expand Down
Binary file modified data/wklife.RData
Binary file not shown.
Empty file modified man/ages.Rd 100755 → 100644
Empty file.
Empty file modified man/cas.Rd 100755 → 100644
Empty file.
Empty file modified man/cc.Rd 100755 → 100644
Empty file.
Empty file modified man/dnormal.Rd 100755 → 100644
Empty file.
Empty file modified man/elasticity.Rd 100755 → 100644
Empty file.
Empty file modified man/gascuel.Rd 100755 → 100644
Empty file.
Empty file modified man/gislason.Rd 100755 → 100644
Empty file.
Empty file modified man/gompertz.Rd 100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions man/grwdd.Rd 100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified man/knife.Rd 100755 → 100644
Empty file.
Empty file modified man/lambda.Rd 100755 → 100644
Empty file.
Empty file modified man/len2wt.Rd 100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion man/leslie.Rd 100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified man/lhEql.Rd 100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion man/lhPar.Rd 100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified man/lhRef.Rd 100755 → 100644
Empty file.
Empty file modified man/logistic.Rd 100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions man/lopt.Rd 100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified man/loptAge.Rd 100755 → 100644
Empty file.
Empty file modified man/lorenzen.Rd 100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion man/m.Rd 100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified man/matdd.Rd 100755 → 100644
Empty file.

0 comments on commit 7dacebd

Please sign in to comment.