Skip to content

Commit

Permalink
Added aStandard and StdIntLit
Browse files Browse the repository at this point in the history
  • Loading branch information
droglenc committed May 22, 2018
1 parent 8294218 commit fbaf787
Show file tree
Hide file tree
Showing 20 changed files with 621 additions and 10 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
^README\.md
^\.travis\.yml$
^appveyor\.yml$
^data-raw$
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(RFBCoptions)
export(aStandard)
export(addRadCap)
export(backCalc)
export(bcFuns)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added tests.
* Updated "Collect Data" vignette for changes to `combineData()`.
* Changed "Back-calculating Lengths" vignette for new `backCalc()`.
* `aStandard()`: Added. Addresses [#10](https://github.com/droglenc/RFishBC/issues/10).
* `backCalc()`: Added.
* `bcFuns()`: Modified. Changed to using `STOP()`. Changed all `Lc` to `Lcap`, `Rc` to `Rcap`, `agec` to `Acap`, and `agei` to `Ai`. Changed all BPH-related models to use `a`, `b`, and `c` and all SPH-related odels to use `A`, `B`, and `C`. Started using `iGetBCMethod()`. Removed `verbose=` (moved to within the returned function).
* `bcUtilChecker()`: Modified. Changed to using `STOP()` and `WARN()`.
Expand All @@ -13,6 +14,7 @@
* `iGetBCMethod()`: Added. Used in `backCalc()` and `bcFuns()`.
* `SMBassWB1`: Added.
* `SMBassWB2`: Added.
* `StdIntLit`: Added.

# RFishBC 0.0.8 13-May-18
* Added tests.
Expand Down
17 changes: 17 additions & 0 deletions R/StdIntLit.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#' @title Standard intercepts for Fraser-Lee model by species.
#'
#' @description Standard intercepts (in mm) for Fraser-Lee model for all species for which the standard has been defined.
#'
#' @format A data frame with 1 rows and 3 variables:
#' \describe{
#' \item{species}{Fish species.}
#' \item{a}{Standard intercept value (in mm).}
#' \item{source}{Source of the standard.}
#' }
#'
#' @references Beck, H.D., D.W. Willis, and J.M. Francis. 1997. A proposed standard intercept for the White Bass body length-scale relationship. North American Journal of Fisheries Management 32:239-248.
#'
#' Carlander, K.D. 1982. Standard intercepts for calculating lengths from scale measurements for some centrarchid and percid fishes. Transactions of the American Fisheries Society 111:333-336.
#'
#' @seealso \code{\link{aStandard}}
"StdIntLit"
32 changes: 32 additions & 0 deletions R/aStandard.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#' @title Finds standard intercept (a) for Fraser-Lee back-calculation model for a particular species.
#'
#' @description Finds standard intercept (a; mm) for Fraser-Lee back-calculation model for a particular species for all species for which a value of a has been defined.
#'
#' @param species A string that contains the species name for which to find teh standard intercept value.
#' @return A single value from \code{\link{StdIntLit}} that is the standard intercept value (a; mm) for the species provided in \code{species}.
#'
#' @author Derek H. Ogle, \email{derek@@derekogle.com}
#'
#' @seealso \code{\link{StdIntLit}}
#'
#' @keywords manip
#'
#' @examples
#' aStandard("Bluegill")
#' aStandard("Walleye")
#'
#' @export
aStandard <- function(species) {
# Load StdIntLit data frame into this function's environment. The data/get
# combination are used to avoide the "no global binding" note at CHECK
StdIntLit <- get(utils::data("StdIntLit",envir=environment()),envir=environment())
# Check species
if (missing(species)) STOP("'species' must be one of: ",
paste(StdIntLit$species,collapse=", "))
species <- FSA::capFirst(species)
if (length(species)>1) STOP("Can have only one name in 'species'.")
if (!species %in% StdIntLit$species) STOP("'species' must be one of: ",
paste(StdIntLit$species,collapse=", "))
# Return a for that species
StdIntLit$a[StdIntLit==species]
}
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
title: RFishBC

url: http://derekogle.com/RFishBC

authors:
Derek H. Ogle:
href: http://derekogle.com
Expand All @@ -25,6 +27,7 @@ reference:
contents:
- backCalc
- bcFuns
- aStandard
- title: Utilities
desc: Functions to perform miscellaneous utilities.
contents:
Expand All @@ -36,6 +39,7 @@ reference:
contents:
- SMBassWB1
- SMBassWB2
- StdIntLit

navbar:
type: inverse
Expand Down
3 changes: 3 additions & 0 deletions data-raw/StdIntLit.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
StdIntLit <- read.csv("data-raw/StdIntLit.csv",stringsAsFactors=FALSE)
str(StdIntLit)
save(StdIntLit,file="data/StdIntLit.RData")
13 changes: 13 additions & 0 deletions data-raw/StdIntLit.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
species,a,source
Black Crappie,35,Carlander (1982)
Bluegill,20,Carlander (1982)
Green Sunfish,10,Carlander (1982)
Largemouth Bass,20,Carlander (1982)
Pumpkinseed,25,Carlander (1982)
Rock Bass,25,Carlander (1982)
Smallmouth Bass,35,Carlander (1982)
Walleye,55,Carlander (1982)
Warmouth,20,Carlander (1982)
White Bass,40,Beck et al. (1997)
White Crappie,35,Carlander (1982)
Yellow Perch,30,Carlander (1982)
Binary file added data/StdIntLit.RData
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/news/index.html

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

3 changes: 3 additions & 0 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ articles:
BCIntro: BCIntro/BCIntro.html
collectRadiiData: MeasureRadii/collectRadiiData.html
seeRadiiData: MeasureRadii/seeRadiiData.html
urls:
reference: http://derekogle.com/RFishBC/reference
article: http://derekogle.com/RFishBC/articles

183 changes: 183 additions & 0 deletions docs/reference/StdIntLit.html

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

Loading

0 comments on commit fbaf787

Please sign in to comment.