diff --git a/DESCRIPTION b/DESCRIPTION
index 01f54531..cbac8c74 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: FSA
-Version: 0.10.0
-Date: 2025-5-6
+Version: 0.10.1
+Date: 2026-1-7
Title: Simple Fisheries Stock Assessment Methods
Description: A variety of simple fish stock assessment methods.
Authors@R: c(
@@ -45,7 +45,7 @@ Suggests:
tidyr,
covr
Encoding: UTF-8
-RoxygenNote: 7.3.2
+RoxygenNote: 7.3.3
Config/testthat/edition: 3
Config/Needs/website:
r-lib/pkgdown,
diff --git a/NEWS.md b/NEWS.md
index 446706ae..a4187fb6 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,15 @@
+# FSA 0.10.1
+* Updated the PSD and Relative Weight computation articles to reflect the changes to `psdVal()`, `psdAdd()`, `wsVal()`, and `wrAdd()`.
+* `chapmanRobson()`: Added catch for when n+T<1 and n+T<2. This addresses [#131](https://github.com/fishR-Core-Team/FSA/issues/131)).
+* `metaM()`: Added `method="HamelCope"` to address [#133](https://github.com/fishR-Core-Team/FSA/issues/133). A few minor edits to documentation.
+* `psdAdd()`: Addressed bugs as described in [#136](https://github.com/fishR-Core-Team/FSA/issues/136)) and [#137](https://github.com/fishR-Core-Team/FSA/issues/137). Added `thesaurus` functionality. Reworked examples in documentation. Reworked testing framework. Thanks to Dave Glover.
+* `PSDlit`: Added info for Flier and Longear Sunfish to address [#122](https://github.com/fishR-Core-Team/FSA/issues/122)) and Northern Pikeminnow. Also updated information for Alabama Bass and Spotted Bass. Duplicated lines that combine `species` and `group` to partially address [#137](https://github.com/fishR-Core-Team/FSA/issues/137).
+* `psdVal()`: Added `dat=` to allow more flexibility when called from `psdAdd()`.
+* `PSDWRTest`: Added for testing PSD and relative weight functions.
+* `wrAdd()`: Addressed bugs similar to those for `psdAdd()`. Added `thesaurus` functionality. Reworked examples in documentation. Reworked testing framework (especially expanded validation of results with hand-calculations).
+* `wSlit`: Added info for Flier and Longear Sunfish to address [#122](https://github.com/fishR-Core-Team/FSA/issues/122)). Also updated information for Alabama Bass (further removed Spotted Bass (Alabama subspecies)), Spotted Bass, and Northern Pikeminnow (further removed Northern Squawfish (synonym of Northern Pikeminnow that is no longer used)). Duplicated lines that combine `species` and `group` to partially address [#137](https://github.com/fishR-Core-Team/FSA/issues/137).
+* `wsVal()`: Added `dat=` to allow more flexibility when called from `wrAdd()`.
+
# FSA 0.10.0
* Updated `test-coverage.yaml` and moved a `# nocov start` and `# nocov end` in `bootstrap.r` to address the errors with `test-coverage.yaml`. Addresses [#118](https://github.com/fishR-Core-Team/FSA/issues/118).
* Removed `DescTools`, `plyr`, `psych` from Suggests (and all their uses in tests and linked code in documentation). Removed `ggplot2`, `marked`, `rcapture`, and `tibble` from Suggests (and use in examples was put in a `\dontrun()`).
@@ -122,11 +134,11 @@
* `fitPlot()`: **REMOVED** (to `FSAmisc`).
* `fsaNews()` and `FSANews()`: **Removed**.
* `psdAdd()`: Modified. Changed the way `PSDlit` was loaded into the function environment so that `FSA::psdAdd()` will work. Addresses [#85](https://github.com/fishR-Core-Team/FSA/issues/85).
-* `PSDLit`: Modified. Added info for Utah Chub (from [here](https://webpages.uidaho.edu/quistlab/publications/NAJFM_2021_Black_et_al_UTC_Ws_length_categories.pdf); address [#84](https://github.com/fishR-Core-Team/FSA/issues/84)).
+* `PSDLit`: Modified. Added info for Utah Chub (from [here](https://www.usgs.gov/publications/proposed-standard-weight-ws-equation-and-length-categories-utah-chub); address [#84](https://github.com/fishR-Core-Team/FSA/issues/84)).
* `psdVal()`: Modified. Changed the way `PSDlit` was loaded into the function environment so that `FSA::psdVal()` will work. Addresses [#85](https://github.com/fishR-Core-Team/FSA/issues/85).
* `residPlot()`: **REMOVED** (to `FSAmisc`).
* `wrAdd()`: Modified. Changed the way `WSlit` was loaded into the function environment so that `FSA::wrAdd()` will work. Addresses [#85](https://github.com/fishR-Core-Team/FSA/issues/85).
-* `WSLit`: Modified. Added info for Utah Chub (from [here](https://webpages.uidaho.edu/quistlab/publications/NAJFM_2021_Black_et_al_UTC_Ws_length_categories.pdf); address [#84](https://github.com/fishR-Core-Team/FSA/issues/84)).
+* `WSLit`: Modified. Added info for Utah Chub (from [here](https://www.usgs.gov/publications/proposed-standard-weight-ws-equation-and-length-categories-utah-chub); address [#84](https://github.com/fishR-Core-Team/FSA/issues/84)).
* `wsVal()`: Modified. Changed the way `WSlit` was loaded into the function environment so that `FSA::wsVal()` will work. Addresses [#85](https://github.com/fishR-Core-Team/FSA/issues/85).
# FSA 0.9.1
diff --git a/R/PSDWRtest.R b/R/PSDWRtest.R
new file mode 100644
index 00000000..fc2b00c0
--- /dev/null
+++ b/R/PSDWRtest.R
@@ -0,0 +1,44 @@
+#' @title Hypothetical weight-length data for testing PSD and relative weight functions
+#'
+#' @description Hypothetical weight-length and associated data. These data are useful for testing PSD and relative weight functions (e.g., \code{\link{psdAdd}} and \code{\link{wrAdd}}).
+#'
+#' @name PSDWRtest
+#'
+#' @docType data
+#'
+#' @format A data frame of many observations on the following 5 variables:
+#' \describe{
+#' \item{species}{Species name}
+#' \item{location}{Broad location of capture}
+#' \item{len}{Length in mm}
+#' \item{wt}{Weight in g}
+#' \item{sex}{Sex as \code{F} for female, \code{M} for male, or \code{U} or \code{NA} for unknown or unrecorded}
+#' }
+#'
+#' @section Topic(s):
+#' \itemize{
+#' \item Size structure
+#' \item Proportional size structure
+#' \item Relative stock density
+#' \item Proportional stock density
+#' \item Relative weight
+#' \item Standard weight
+#' \item Condition
+#' }
+#'
+#' @concept Size Structure
+#' @concept PSD
+#' @concept Condition
+#' @concept Relative Weight
+#' @concept Standard Weight
+#'
+#' @seealso \code{\link{psdAdd}}, \code{\link{psdCalc}}, and \code{\link{wrAdd}}
+#'
+#' @keywords datasets
+#'
+#' @examples
+#' str(PSDWRtest)
+#' peek(PSDWRtest,n=20)
+#' unique(PSDWRtest$species)
+#'
+NULL
diff --git a/R/PSDlit.R b/R/PSDlit.R
index 6871db94..f6393258 100644
--- a/R/PSDlit.R
+++ b/R/PSDlit.R
@@ -1,6 +1,9 @@
#' @title Gabelhouse five-cell length categories for various species.
#'
#' @description Cutoffs for the Gabelhouse five-cell length categories for a variety of species.
+#'
+#' @details Entries for some species (e.g., \dQuote{Muskellunge} and \dQuote{Walleye}) have been duplicated for sub-groups to facilitate use with relative weight calculations. For example, entries for \dQuote{Muskellunge (overall)}, \dQuote{Muskellunge (female)}, and \dQuote{Muskellunge (male)} are duplicates of the entry for \dQuote{Muskellunge}; i.e., these entries in \code{PSDlit} are not necessarily just for those sub-groups but this allows for seamless similar computations of relative weights for these sub-groups.
+#'
#'
#' @name PSDlit
#'
diff --git a/R/WSlit.R b/R/WSlit.R
index d6e34ec6..e1d8e4ca 100644
--- a/R/WSlit.R
+++ b/R/WSlit.R
@@ -3,6 +3,8 @@
#' @description Parameters for all known standard weight equations.
#'
#' @details The minimum TL for the English units were derived by rounding the converted minimum TL for the metric units to what seemed like common units (inches, half inches, or quarter inches).
+#'
+#' Entries for \dQuote{Chinook Salmon (landlocked)} and \dQuote{Striped Bass (landlocked)} are the same as for \dQuote{Chinook Salmon} and \dQuote{Striped Bass} but were added to facilitate use with PSD calculations as Gabelhouse lengths are only published for the landlocked sub-group; i.e., these entries in \code{WSlit} are not necessarily just for landlocked populations.
#'
#' @name WSlit
#'
diff --git a/R/chapmanRobson.R b/R/chapmanRobson.R
index bf8c369c..5cce7685 100644
--- a/R/chapmanRobson.R
+++ b/R/chapmanRobson.R
@@ -164,7 +164,17 @@ chapmanRobson.default <- function(x,catch,ages2use=age,
n <- sum(catch.e,na.rm=TRUE)
T <- sum(age.r*catch.e,na.rm=TRUE)
## Estimate S and SE (eqns 6.4 & 6.5 from Miranda & Bettoli (2007))
+ if (n+T<1) STOP("The sum of 'catch' (n) and the product of 'age' and 'catch'",
+ " (T) for 'ages2use' is less than 1, so survival (S) cannot",
+ " be computed. This usually occurs when 'catch' is actually",
+ " 'CPE' and the 'CPE' values are very small. If this is the",
+ " case, consider rescaling your 'CPE' values.")
S.est <- T/(n+T-1)
+ if (n+T<2) STOP("The sum of 'catch' (n) and the product of 'age' and 'catch'",
+ " (T) for 'ages2use' is less than 2, so the SE of survival (S)",
+ " cannot be computed. This usually occurs when 'catch' is",
+ " actually 'CPE' and the 'CPE' values are very small. If this",
+ " is the case, consider rescaling your 'CPE' values.")
S.SE <- sqrt(S.est*(S.est-((T-1)/(n+T-2))))
## Estimate Z and SE
switch(zmethod,
diff --git a/R/metaM.R b/R/metaM.R
index 865f09dc..b8a68564 100644
--- a/R/metaM.R
+++ b/R/metaM.R
@@ -13,6 +13,7 @@
#' \item \code{method="HoenigLM"}: The \dQuote{modified Hoenig equation derived with a linear model} as described in Then \emph{et al.} (2015) on the second line of Table 3. Requires only \code{tmax}.
#' \item \code{method="HewittHoenig"}: The \dQuote{Hewitt and Hoenig (2005) equation} from their equation 8. Requires only \code{tmax}.
#' \item \code{method="tmax1"}: The \dQuote{one-parameter tmax equation} from the first line of Table 3 in Then \emph{et al.} (2015). Requires only \code{tmax}.
+#' \item \code{method="HamelCope"}: The equation 7 from Hamel and Cope (2022). Requires only \code{tmax}.
#' \item \code{method="K1"}: The \dQuote{one-parameter K equation} from the fourth line of Table 3 in Then \emph{et al.} (2015). Requires only \code{K}.
#' \item \code{method="K2"}: The \dQuote{two-parameter K equation} from the fifth line of Table 3 in Then \emph{et al.} (2015). Requires only \code{K}.
#' \item \code{method="JensenK1"}: The \dQuote{Jensen (1996) one-parameter K equation}. Requires only \code{K}.
@@ -54,15 +55,15 @@
#' \item \code{givens}: A string that contains the input values required by the method to estimate M.
#' }
#'
-#' @section Testing: Kenchington (2014) provided life history parameters for several stocks and used many models to estimate M. I checked the calculations for the \code{PaulyL}, \code{PaulyW}, \code{HoenigO}, \code{HoenigOF}, \code{HoenigO2}, \code{HoenigO2F}, \code{"JensenK1"}, \code{"Gislason"}, \code{"AlversonCarney"}, \code{"Charnov"}, \code{"ZhangMegrey"}, \code{"RikhterEfanov1"}, and \code{"RikhterEfanov2"} methods for three stocks. All results perfectly matched Kenchington's results for Chesapeake Bay Anchovy and Rio Formosa Seahorse. For the Norwegian Fjord Lanternfish, all results perfectly matched Kenchington's results except for \code{HoenigOF} and \code{HoenigO2F}.
+#' @section Testing: Kenchington (2014) provided life history parameters for several stocks and used many models to estimate M. I checked the calculations for the \code{"PaulyL"}, \code{"PaulyW"}, \code{"HoenigO"}, \code{"HoenigOF"}, \code{"HoenigO2"}, \code{"HoenigO2F"}, \code{"JensenK1"}, \code{"Gislason"}, \code{"AlversonCarney"}, \code{"Charnov"}, \code{"ZhangMegrey"}, \code{"RikhterEfanov1"}, and \code{"RikhterEfanov2"} methods for three stocks. All results perfectly matched Kenchington's results for Chesapeake Bay Anchovy and Rio Formosa Seahorse. For the Norwegian Fjord Lanternfish, all results perfectly matched Kenchington's results except for \code{"HoenigOF"} and \code{"HoenigO2F"}.
#'
-#' Results for the Rio Formosa Seahorse data were also tested against results from \code{\link[fishmethods]{M.empirical}} from \pkg{fishmethods} for the \code{PaulyL}, \code{PaulyW}, \code{HoenigO}, \code{HoenigOF}, \code{"Gislason"}, and \code{"AlversonCarney"} methods (the only methods in common between the two packages). All results matched perfectly.
+#' Results for the Rio Formosa Seahorse data were also tested against results from \code{\link[fishmethods]{M.empirical}} from \pkg{fishmethods} for the \code{"PaulyL"}, \code{"PaulyW"}, \code{"HoenigO"}, \code{"HoenigOF"}, \code{"Gislason"}, and \code{"AlversonCarney"} methods (the only methods in common between the two packages). All results matched perfectly.
#'
#' @author Derek H. Ogle, \email{DerekOgle51@gmail.com}
#'
#' @section IFAR Chapter: 11-Mortality.
#'
-#' @seealso See \code{\link[fishmethods]{M.empirical}} in \pkg{fishmethods} for similar functionality.
+#' @seealso See \code{\link[fishmethods]{M.empirical}} in \pkg{fishmethods} for similar functionality and the "Natural Mortality Tool" Shiny app on-line.
#'
#' @references Ogle, D.H. 2016. \href{https://fishr-core-team.github.io/fishR/pages/books.html#introductory-fisheries-analyses-with-r}{Introductory Fisheries Analyses with R}. Chapman & Hall/CRC, Boca Raton, FL.
#'
@@ -74,6 +75,8 @@
#'
#' Gislason, H., N. Daan, J.C. Rice, and J.G. Pope. 2010. Size, growth, temperature and the natural mortality of marine fish. Fish and Fisheries 11:149-158.
#'
+#' Hamel, O. and J. M. Cope. 2022. Development and considerations for application of a longevity-based prior for the natural mortality rate. Fisheries Research 256:106477 [Was (is? from https://www.researchgate.net/publication/363595336_Development_and_considerations_for_application_of_a_longevity-based_prior_for_the_natural_mortality_rate).]
+#'
#' Hewitt, D.A. and J.M. Hoenig. 2005. Comparison of two approaches for estimating natural mortality based on longevity. Fishery Bulletin. 103:433-437. [Was (is?) from http://fishbull.noaa.gov/1032/hewitt.pdf.]
#'
#' Hoenig, J.M. 1983. Empirical use of longevity data to estimate mortality rates. Fishery Bulletin. 82:898-903. [Was (is?) from http://www.afsc.noaa.gov/REFM/age/Docs/Hoenig_EmpiricalUseOfLongevityData.pdf.]
@@ -108,7 +111,7 @@
#' Mmethods("tmax")
#'
#' ## Simple Examples
-#' metaM("tmax",tmax=20)
+#' metaM("HamelCope",tmax=20)
#' metaM("HoenigNLS",tmax=20)
#' metaM("HoenigNLS",tmax=20,verbose=FALSE)
#'
@@ -133,7 +136,7 @@
#'
#' ## Example of multiple methods using Mmethods
#' # select some methods
-#' metaM(Mmethods()[-c(15,20,22:24,26:29)],K=K,Linf=Linf,Temp=Temp,tmax=tmax,t50=t50)
+#' metaM(Mmethods()[-c(16,21,23:25,27:30)],K=K,Linf=Linf,Temp=Temp,tmax=tmax,t50=t50)
#' # select just the Hoenig methods
#' metaM(Mmethods("Hoenig"),K=K,Linf=Linf,Temp=Temp,tmax=tmax,t50=t50)
#'
@@ -150,7 +153,7 @@ Mmethods <- function(method=c("all","tmax","K","Hoenig","Pauly","FAMS")) {
method <- match.arg(method)
all_meth <- c("HoenigNLS","HoenigO","HoenigOF","HoenigOM","HoenigOC",
"HoenigO2","HoenigO2F","HoenigO2M","HoenigO2C",
- "HoenigLM","HewittHoenig","tmax1",
+ "HoenigLM","HewittHoenig","tmax1","HamelCope",
"PaulyLNoT","PaulyL","PaulyW",
"K1","K2","JensenK1","JensenK2","Gislason",
"AlversonCarney","Charnov",
@@ -161,7 +164,7 @@ Mmethods <- function(method=c("all","tmax","K","Hoenig","Pauly","FAMS")) {
P_meth <-
switch(method,
all = { meths <- all_meth },
- tmax = { meths <- c("tmax1",H_meth)},
+ tmax = { meths <- c("HamelCope","tmax1",H_meth)},
K = { meths <- c("K1","K2","JensenK1","JensenK2")},
Hoenig = { meths <- H_meth},
Pauly = { meths <- all_meth[grep("Pauly",all_meth)] },
@@ -191,6 +194,11 @@ metaM <- function(method=Mmethods(),
metaM1 <- function(method,tmax,K,Linf,t0,b,L,Temp,t50,Winf,PS,...) {
switch(method,
+ HamelCope = { ## from Hamel & Cope (2022), Equation 7
+ name <- "Hamel and Cope (2022) tmax equation"
+ iCheck_tmax(tmax)
+ givens <- c(tmax=tmax)
+ M <- 5.40/tmax },
tmax1 = { ## from Then et al. (2015), Table 3, 1st line
name <- "Then et al. (2015) tmax equation"
iCheck_tmax(tmax)
diff --git a/R/psdAdd.R b/R/psdAdd.R
index 569d69e9..4010c326 100644
--- a/R/psdAdd.R
+++ b/R/psdAdd.R
@@ -6,6 +6,7 @@
#' @param species A character or factor vector that contains the species names. Ignored if \code{len} is a formula.
#' @param group A named list that provides specific choices for \code{group} for species for which more than one set of Gabelhouse lengths exists in \code{\link{PSDlit}}.
#' @param data A data.frame that minimally contains the length measurements and species names if \code{len} is a formula.
+#' @param thesaurus A named list for providing alternative species names (the values in the list) that correspond to specific names in \code{PSDlit} (the names in the list). See details and examples.
#' @param units A string that indicates the type of units used for the lengths. Choices are \code{mm} for millimeters (DEFAULT), \code{cm} for centimeters, and \code{in} for inches.
#' @param use.names A logical that indicates whether the vector returned is numeric (\code{=FALSE}) or string (\code{=TRUE}; default) representations of the Gabelhouse lengths. See details.
#' @param as.fact A logical that indicates that the new variable should be returned as a factor (\code{=TRUE}) or not (\code{=FALSE}). Defaults to same as \code{use.names} unless \code{addLens} is not \code{NULL}, in which case it will default to \code{FALSE}. See details.
@@ -15,7 +16,9 @@
#'
#' @details This computes a vector that contains the Gabelhouse lengths specific to each species for all individuals in an entire data frame. The vector can be appended to an existing data.frame to create a variable that contains the Gabelhouse lengths for each individual. The Gabelhouse length value will be \code{NA} for each individual for which Gabelhouse length definitions do not exist in \code{\link{PSDlit}}. Species names in the data.frame must be the same as those used in \code{\link{PSDlit}} (i.e., same spelling and capitalization; use \code{psdVal()} to see the list of species).
#'
-#' Some species have Gabelhouse lengths for sub-groups (e.g., \dQuote{lentic} vs \dQuote{lotic}). For these species, choose which sub-group to use with \code{group}.
+#' The \code{thesaurus} argument may be used to relate alternate species names to the species names used in \code{PSDlit}. For example, you (or your data) may use \dQuote{Bluegill Sunfish}, but \dQuote{Bluegill} is used in \code{PSDlit}. The alternate species name can be used here if it is defined in a named vector (or list) given to \code{thesarus=}. The alternate species name is the value and the species name in \code{PSDlit} is the name in this vector/list - e.g., \code{c("Bluegill"="Bluegill Sunfish")}. See the examples for a demonstration.
+#'
+#' Some species have length categories separated by sub-group. For example, length categories exist for both lentic and lotic populations of Brown Trout. The length values for a sub-group may be obtained by either including the species name in \code{species} and the sub-group name in \code{group} or by using the combined species and sub-group name, with the sub-group name in parentheses, in \code{species}. Both methods are demonstrated in the examples. Note that an error is returned if a species has sub-groups but neither method is used to define the sub-group.#'
#'
#' Individuals shorter than \dQuote{stock} length will be listed as \code{substock} if \code{use.names=TRUE} or \code{0} if \code{use.names=FALSE}.
#'
@@ -42,63 +45,112 @@
#' @keywords manip
#'
#' @examples
-#' #===== Create random data for three species
-#' set.seed(345234534)
-#' dbg <- data.frame(species=factor(rep(c("Bluegill"),30)),
-#' tl=round(rnorm(30,130,50),0))
-#' dlb <- data.frame(species=factor(rep(c("Largemouth Bass"),30)),
-#' tl=round(rnorm(30,350,60),0))
-#' dbt <- data.frame(species=factor(rep(c("Bluefin Tuna"),30)),
-#' tl=round(rnorm(30,1900,300),0))
-#' df <- rbind(dbg,dlb,dbt)
-#'
-#' #===== Simple examples
+#' #===== Simple examples -- 2 species, no groups, names as in PSDlit
+#' #----- Isolate simple data from PSDWRtest
+#' tmp <- subset(PSDWRtest,
+#' species %in% c("Yellow Perch","Largemouth Bass"),
+#' select=c("species","len"))
+#' peek(tmp,n=6)
+#'
#' #----- Add variable using category names -- non-formula notation
-#' df$PSD <- psdAdd(df$tl,df$species)
-#' peek(df,n=6)
+#' tmp$PSD <- psdAdd(tmp$len,tmp$species)
+#' peek(tmp,n=6)
#'
#' #----- Add variable using category names -- formula notation
-#' df$PSD1 <- psdAdd(tl~species,data=df)
-#' peek(df,n=6)
+#' tmp$PSD1 <- psdAdd(len~species,data=tmp)
+#' peek(tmp,n=6)
#'
#' #----- Add variable using length values as names
-#' # Also turned off messaging of fish not in PSDlit
-#' df$PSD2 <- psdAdd(tl~species,data=df,use.names=FALSE,verbose=FALSE)
-#' peek(df,n=6)
+#' tmp$PSD2 <- psdAdd(len~species,data=tmp,use.names=FALSE)
+#' peek(tmp,n=6)
#'
#' #----- Same as above but using dplyr
#' if (require(dplyr)) {
-#' df <- df %>%
-#' mutate(PSD1A=psdAdd(tl,species,verbose=FALSE),
-#' PSD2A=psdAdd(tl,species,use.names=FALSE,verbose=FALSE))
-#' peek(df,n=6)
+#' tmp <- tmp %>%
+#' mutate(PSD1A=psdAdd(len,species),
+#' PSD2A=psdAdd(len,species,use.names=FALSE))
+#' peek(tmp,n=6)
#' }
#'
-#' #===== Adding lengths besides the Gabelhouse lengths
-#' #----- Add a "minimum length" for Bluegill
-#' df$PSD3 <- psdAdd(tl~species,data=df,verbose=FALSE,
-#' addLens=list("Bluegill"=c("minLen"=175)))
-#' df$PSD3A <- psdAdd(tl~species,data=df,verbose=FALSE,
-#' addLens=list("Bluegill"=175))
-#' df$PSD3B <- psdAdd(tl~species,data=df,verbose=FALSE,
-#' addLens=list("Bluegill"=c("minLen"=175)),use.names=FALSE)
-#' head(df,n=6)
-#'
-#' #----- Add add'l lengths and names for Bluegill and Largemouth Bass
-#' df$psd4 <- psdAdd(tl~species,data=df,verbose=FALSE,
-#' addLens=list("Bluegill"=175,
-#' "Largemouth Bass"=c(254,356)))
-#' peek(df,n=20)
-#'
-#' #===== Example for a species with sub-groups
-#' dbt <- data.frame(species=factor(rep(c("Brown Trout"),30)),
-#' tl=round(rnorm(30,230,50),0))
-#' dlt <- data.frame(species=factor(rep(c("Lake Trout"),30)),
-#' tl=round(rnorm(30,550,60),0))
-#' df2 <- rbind(dbt,dlt)
-#'
-#' df2$psd <- psdAdd(tl~species,data=df2,group=list("Brown Trout"="lentic"))
-#' peek(df2,n=6)
+#' #===== Add lengths besides Gabelhouse lengths (start over with same simple data)
+#' tmp <- subset(PSDWRtest,
+#' species %in% c("Yellow Perch","Largemouth Bass"),
+#' select=c("species","len"))
+#'
+#' #----- Add a "minimum length" for one species
+#' tmp$PSD3 <- psdAdd(len~species,data=tmp,
+#' addLens=list("Yellow Perch"=c("minLen"=225)))
+#' tmp$PSD3A <- psdAdd(len~species,data=tmp,
+#' addLens=list("Yellow Perch"=225))
+#' tmp$PSD3B <- psdAdd(len~species,data=tmp,
+#' addLens=list("Yellow Perch"=c("minLen"=225)),use.names=FALSE)
+#' head(tmp,n=6)
+#'
+#' #----- Add add'l lengths and names for multiple species
+#' tmp$psd4 <- psdAdd(len~species,data=tmp,
+#' addLens=list("Yellow Perch"=175,
+#' "Largemouth Bass"=c(254,306)))
+#' peek(tmp,n=20)
+#'
+#' #===== Handle additional species in PSDlit but named differently
+#' #----- Isolate different species data from PSDWRtest
+#' tmp <- subset(PSDWRtest,
+#' species %in% c("Bluegill Sunfish","Lean Lake Trout"),
+#' select=c("species","len"))
+#'
+#' #----- No "Bluegill Sunfish" in PSDlit, use thesaurus to note this is "Bluegill"
+#' # Note: "Lean Lake Trout" not processed as not in PSDlit
+#' tmp$psd5 <- psdAdd(len~species,data=tmp,
+#' thesaurus=c("Bluegill"="Bluegill Sunfish"))
+#' peek(tmp,n=6)
+#'
+#' #----- Process multiple species in PSDlit with different names
+#' # Note: Can still use addLens=, but with original name
+#' thes <- c("Bluegill"="Bluegill Sunfish","Lake Trout"="Lean Lake Trout")
+#' tmp$psd6 <- psdAdd(len~species,data=tmp,thesaurus=thes)
+#' tmp$psd7 <- psdAdd(len~species,data=tmp,thesaurus=thes,
+#' addLens=list("Bluegill Sunfish"=c("minLen"=175)))
+#' peek(tmp,n=20)
+#'
+#' #===== Example for a species with sub-groups but only one sub-group in data
+#' #----- Isolate species data from PSDWRtest ... only Brook Trout has sub-group
+#' tmp <- subset(PSDWRtest,
+#' species %in% c("Yellow Perch","Brook Trout"),
+#' select=c("species","len"))
+#'
+#' #----- This will err as Brook Trout has sub-groups in PSDlit (as message notes)
+#' # tmp$psd8 <- psdAdd(len~species,data=tmp)
+#'
+#' #----- Can choose "overall" sub-group with group=
+#' tmp$psd8 <- psdAdd(len~species,data=tmp,
+#' group=list("Brook Trout"="overall"))
+#' peek(tmp,n=10)
+#'
+#' #----- Or can create species name with sub-group name in parentheses
+#' # Note: this is more useful in next examples
+#' tmp$species2 <- ifelse(tmp$species=="Brook Trout","Brook Trout (overall)",
+#' tmp$species)
+#' tmp$psd8A <- psdAdd(len~species2,data=tmp) # note use of species2
+#' peek(tmp,n=10)
+#'
+#' #===== Example for species with more than one sub-group in data
+#' #----- Isolate species data from PSDWRtest ... Brown Trout has two sub-groups
+#' tmp <- subset(PSDWRtest,
+#' species %in% c("Yellow Perch","Largemouth Bass","Brown Trout"),
+#' select=c("species","len","location"))
+#' peek(tmp,n=10)
+#'
+#' #----- Must create a species name variable with sub-groups in parentheses
+#' # Note: there are likely many ways to do this specific to each use-case
+#' tmp$species2 <- tmp$species
+#' tmp$species2[tmp$species=="Brown Trout" &
+#' tmp$location=="Trout Lake"] <- "Brown Trout (lotic)"
+#' tmp$species2[tmp$species=="Brown Trout" &
+#' tmp$location=="Brushy Creek"] <- "Brown Trout (lentic)"
+#' peek(tmp,n=10)
+#'
+#' tmp$psd9 <- psdAdd(len~species2,data=tmp)
+#' peek(tmp,n=10)
#'
#' @rdname psdAdd
#' @export
@@ -108,7 +160,8 @@ psdAdd <- function (len,...) {
#' @rdname psdAdd
#' @export
-psdAdd.default <- function(len,species,group=NULL,units=c("mm","cm","in"),
+psdAdd.default <- function(len,species,thesaurus=NULL,
+ group=NULL,units=c("mm","cm","in"),
use.names=TRUE,
as.fact=ifelse(is.null(addLens),use.names,FALSE),
addLens=NULL,verbose=TRUE,...) {
@@ -118,10 +171,10 @@ psdAdd.default <- function(len,species,group=NULL,units=c("mm","cm","in"),
if (!inherits(species,c("character","factor")))
STOP("'species' must be character or factor.")
## Prepare the PSD literature values data frame
- PSDlit <- FSA::PSDlit
+ PSDlit <- iPrepPSDlit(thesaurus)
## Find species that have known Gabelhouse lengths
- # get list of species in data
- specs <- unique(species)
+ # get list of species in data ... change from factor to character if necessary
+ specs <- as.character(unique(species))
GLHSspecs <- specs[specs %in% unique(PSDlit$species)]
## Create data.frames with species that are NA and w/o Gabelhouse lengths and
## one with Gabelhouse lengths. The loop below will then start with a
@@ -130,7 +183,7 @@ psdAdd.default <- function(len,species,group=NULL,units=c("mm","cm","in"),
# - rownumbers is needed to get back the original order
# - PSD will eventually have the Gabelhouse length categories
data <- data.frame(len,species,rownums=seq_along(len),PSD=rep(NA,length(len)))
- # data.frame where species is NA and doesn't have Gabelhousee length
+ # data.frame where species is NA and doesn't have Gabelhouse length
ndata <- data[is.na(data$species) | !data$species %in% GLHSspecs,]
if (verbose & nrow(ndata)>0)
MESSAGE("Species in the data with no Gabelhouse (PSD) lengths in `PSDlit`: ",
@@ -138,7 +191,7 @@ psdAdd.default <- function(len,species,group=NULL,units=c("mm","cm","in"),
# data.frame where species have Gabelhouse lengths ... make sure no NAs
data <- data[data$species %in% GLHSspecs,]
data <- data[!is.na(data$species),]
-
+
## Cycle through each species where PSD values are known, add PSD categories
## and append to data.frame that contained species w/o Gabelhouse lengths
for (i in seq_along(GLHSspecs)) {
@@ -150,10 +203,11 @@ psdAdd.default <- function(len,species,group=NULL,units=c("mm","cm","in"),
else tmpAddLens <- NULL
# get the Gabelhouse length categories
if (!is.null(group)) {
- if (GLHSspecs[i] %in% names(group)) group <- group[[GLHSspecs[i]]]
- else group <- NULL
- }
- glhse <- psdVal(GLHSspecs[i],group=group,units=units,addLens=tmpAddLens)
+ if (GLHSspecs[i] %in% names(group)) tmp_group <- group[[GLHSspecs[i]]]
+ else tmp_group <- NULL
+ } else tmp_group <- NULL
+ glhse <- psdVal(GLHSspecs[i],group=tmp_group,units=units,addLens=tmpAddLens,
+ dat=PSDlit)
# computes the Gabelhouse length categories and adds to the data frame
if (all(is.na(tmpdf$len))) {
if (verbose) message("All values in 'len' were missing for ",GLHSspecs[i])
@@ -176,7 +230,8 @@ psdAdd.default <- function(len,species,group=NULL,units=c("mm","cm","in"),
#' @rdname psdAdd
#' @export
-psdAdd.formula <- function(len,data=NULL,group=NULL,units=c("mm","cm","in"),
+psdAdd.formula <- function(len,data=NULL,thesaurus=NULL,
+ group=NULL,units=c("mm","cm","in"),
use.names=TRUE,
as.fact=ifelse(is.null(addLens),use.names,FALSE),
addLens=NULL,verbose=TRUE,...) {
@@ -196,6 +251,46 @@ psdAdd.formula <- function(len,data=NULL,group=NULL,units=c("mm","cm","in"),
STOP("'len' must have one and only one factor variable (species)",
" on right-hand-side.")
## Send to default method
- psdAdd.default(tmp$mf[[tmp$Rpos]],tmp$mf[[tmp$EFactPos]],group,units,
+ psdAdd.default(tmp$mf[[tmp$Rpos]],tmp$mf[[tmp$EFactPos]],thesaurus,group,units,
use.names,as.fact,addLens,verbose,...)
}
+
+
+# ==============================================================================
+# Internal -- prepare PSDlit by loading it and replacing its default names with
+# names in the thesaurus, if any
+# ==============================================================================
+iPrepPSDlit <- function(thesaurus) {
+ # Load PSDlit into dat in this function namespace
+ dat <- FSA::PSDlit
+ if (!is.null(thesaurus)) {
+ # Some sanity checks on thesaurus
+ if (!(is.vector(thesaurus) | is.list(thesaurus)))
+ STOP("'thesaurus' must be either a vector or list. ",
+ "Make sure it is not 'factor'ed.")
+ if (length(names(thesaurus))==0)
+ STOP("Values in 'thesaurus' must be named (with species names from 'PSDlit'.")
+ if (!is.character(thesaurus))
+ STOP("Values in 'thesaurus' must be strings of species names.")
+ # thesaurus appears to be a named vector/list of strings ... start processing
+ # Alphabetize names in thesaurus to match PSDlit
+ thesaurus <- thesaurus[order(names(thesaurus))]
+ # Remove name from thesaurus if not in dat/PSDlit
+ thes.nokeep <- which(!names(thesaurus) %in% unique(dat$species))
+ if (length(thes.nokeep)>0) {
+ MESSAGE("The following species names were in 'thesaurus' but do ",
+ "not have an entry in 'PSDlit' and will be ignored: ",
+ iStrCollapse(names(thesaurus)[thes.nokeep]),".")
+ thesaurus <- thesaurus[-thes.nokeep]
+ }
+ # Find dat/PSDlit species in kept thesaurus and change names to thesaurus names
+ if (length(thesaurus)>0) {
+ thes.pos <- which(dat$species %in% names(thesaurus))
+ dat$species[thes.pos] <- unlist(thesaurus)
+ # Re-alphabetize dat/PSDlit
+ dat <- dat[order(dat$species),]
+ }
+ }
+ # Return dat/PSDlit
+ dat
+}
diff --git a/R/psdCalc.R b/R/psdCalc.R
index a960fe22..18ee5674 100644
--- a/R/psdCalc.R
+++ b/R/psdCalc.R
@@ -48,51 +48,53 @@
#' @keywords hplot
#'
#' @examples
-#' #===== Random length data for Yellow Perch (for example) to the nearest mm
-#' set.seed(633437)
-#' yepdf <- data.frame(yepmm=round(c(rnorm(100,mean=125,sd=15),
-#' rnorm(50,mean=200,sd=25),
-#' rnorm(20,mean=270,sd=40)),0),
-#' species=rep("Yellow Perch",170))
-#'
#' #===== Simple (typical) uses with just Gabelhouse lengths
+#' tmp <- subset(PSDWRtest,species=="Yellow Perch",select=c("species","len"))
+#'
#' #----- All results
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch")
+#' psdCalc(~len,data=tmp,species="Yellow Perch")
#'
#' #----- Just the traditional indices
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch",what="traditional")
+#' psdCalc(~len,data=tmp,species="Yellow Perch",what="traditional")
#'
#' #----- Just the incremental indices
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch",what="incremental")
+#' psdCalc(~len,data=tmp,species="Yellow Perch",what="incremental")
#'
#' #===== Add a custom length of interest (to the Gabelhouse lengths)
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch",addLens=150)
+#' psdCalc(~len,data=tmp,species="Yellow Perch",addLens=150)
#'
#' #----- Additional lengths can be named
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch",addLens=c("minLen"=150))
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
+#' psdCalc(~len,data=tmp,species="Yellow Perch",addLens=c("minLen"=150))
+#' psdCalc(~len,data=tmp,species="Yellow Perch",
#' addLens=c("minLen"=150,"maxslot"=275))
#'
#' #----- Can return just those results that include the additional lengths
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
+#' psdCalc(~len,data=tmp,species="Yellow Perch",
#' addLens=c("minSlot"=150,"maxSlot"=275),justAdds=TRUE)
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
+#' psdCalc(~len,data=tmp,species="Yellow Perch",
#' addLens=c("minSlot"=150,"maxSlot"=275),justAdds=TRUE,what="traditional")
#'
#' #===== Can show intermediate values (num in category and in stock)
-#' psdCalc(~yepmm,data=yepdf,species="Yellow Perch",showInterm=TRUE)
+#' psdCalc(~len,data=tmp,species="Yellow Perch",showInterm=TRUE)
+#'
+#' #===== Some species require use of group
+#' tmp <- subset(PSDWRtest,species=="Brown Trout" & location=="Trout Lake",
+#' select=c("species","location","len"))
+#' peek(tmp,n=6)
#'
-#' #===== Some species require use of group (e.g., treat these as if Brown Trout)
-#' psdCalc(~yepmm,data=yepdf,species="Brown Trout",group="lotic")
-#' psdCalc(~yepmm,data=yepdf,species="Brown Trout",group="lentic")
+#' # will err because Brown Trout has sub-groups in PSDlit
+#' # psdCalc(~len,data=tmp,species="Brown Trout")
+#' psdCalc(~len,data=tmp,species="Brown Trout",group="lotic")
+#' psdCalc(~len,data=tmp,species="Brown Trout (lotic)")
#'
#' #===== For species not in PSDlit ... don't include species and use addLens
-#' # Note that these are same data as above, but treated as different species
-#' psdCalc(~yepmm,data=yepdf,addLens=c("stock"=130,"quality"=200,"preferred"=250,
-#' "memorable"=300,"trophy"=380))
+#' # Note these are same data as above, but treated as species not in PSDlit
+#' psdCalc(~len,data=tmp,addLens=c("stock"=130,"quality"=200,"preferred"=250,
+#' "memorable"=300,"trophy"=380))
#'
#' @export psdCalc
-psdCalc <- function(formula,data,species,group=NULL,units=c("mm","cm","in"),
+psdCalc <- function(formula,data,species,
+ group=NULL,units=c("mm","cm","in"),
method=c("multinomial","binomial"),conf.level=0.95,
addLens=NULL,addNames=NULL,justAdds=FALSE,
what=c("all","traditional","incremental","none"),
@@ -105,8 +107,8 @@ psdCalc <- function(formula,data,species,group=NULL,units=c("mm","cm","in"),
#----- Make sure species is not missing, or if it is that addLens have been given
if (!missing(species)) {
- brks <- psdVal(species,group,units=units,incl.zero=FALSE,
- addLens=addLens,addNames=addNames)
+ brks <- psdVal(species,group=group,units=units,
+ incl.zero=FALSE,addLens=addLens,addNames=addNames)
} else {
# species is missing so must have an addLens
if (is.null(addLens))
diff --git a/R/psdVal.R b/R/psdVal.R
index 9ca7ea74..304e7a24 100644
--- a/R/psdVal.R
+++ b/R/psdVal.R
@@ -9,9 +9,12 @@
#' @param addLens A numeric vector that contains minimum length definitions for additional categories. See details.
#' @param addNames A string vector that contains names for the additional length categories added with \code{addLens}. See details.
#' @param showJustSource A logical that indicates whether just the literature source information should be returned (\code{TRUE}) or not. If \code{TRUE} this will NOT return any of the Gabelhouse length information.
+#' @param dat Data.frame of Gabelhouse length categories for all species. Defaults to `PSDlit` and is generally not used by the user (this simplifies use of this function in \code{psdAdd}).
#'
#' @details Finds the Gabelhouse lengths from \code{data(PSDlit)} for the species given in \code{species}. The species name must be spelled exactly (including capitalization) as it appears in \code{data(PSDlit)}. Type \code{psdVal()} to see the list of species and how they are spelled.
#'
+#' Some species have length categories separated by sub-group. For example, length categories exist for both lentic and lotic populations of Brown Trout. The length values for a sub-group may be obtained by either including the species name in \code{species} and the sub-group name in \code{group} or by using the combined species and sub-group name, with the sub-group name in parentheses, in \code{species}. Both methods are demonstrated in the examples. Note that an error is returned if a species has sub-groups but neither method is used to define the sub-group.#'
+#'
#' A zero is included in the first position of the returned vector if \code{incl.zero=TRUE}. This is useful when computing PSD values with a data.frame that contains fish smaller than the stock length.
#'
#' Additional lengths may be added to the returned vector with \code{addLens}. Names for these lengths can be included as names in \code{addLens} or separately in \code{addNames}. If \code{addNames} is NULL and \code{addLens} is not named then the default category names will be the lengths from \code{addLens}. The \code{addLens} argument is useful for calculating PSD values that are different from the Gabelhouse lengths.
@@ -47,10 +50,15 @@
#' psdVal("Bluegill",showJustSource=TRUE)
#'
#' #===== For species that have sub-groups
+#' #----- using group= argument
#' psdVal("Brown Trout",group="lentic")
#' psdVal("Brown Trout",group="lotic")
-#' psdVal("Palmetto Bass",group="revised")
-#' psdVal("Palmetto Bass",group="original")
+#' #----- group combined in species name, so no group= use
+#' psdVal("Brown Trout (lentic)")
+#'
+#' #===== For species with revised values
+#' psdVal("Palmetto Bass")
+#' psdVal("Palmetto Bass (original)")
#'
#' #===== Adding user-defined categories
#' #----- with lengths and names separately in addLens= and addNames=
@@ -60,28 +68,29 @@
#' #----- with a named vector in addLens=
#' psdVal("Bluegill",units="in",addLens=c("MinLen"=7))
#' psdVal("Bluegill",units="in",addLens=c("MinSlot"=7,"MaxSlot"=9))
-#'
+#'
#' @export psdVal
psdVal <- function(species="List",group=NULL,units=c("mm","cm","in"),
addLens=NULL,addNames=NULL,
- incl.zero=TRUE,showJustSource=FALSE) {
+ incl.zero=TRUE,showJustSource=FALSE,dat=NULL) {
units <- match.arg(units)
- #====== Load PSDlit into this function's environment, do some checking, and
- # return a data.frame with infor for just that species/group
- PSDlit <- FSA::PSDlit
- PSDlit <- iPSDGetSpecies(PSDlit,species,group)
+
+ #====== If dat is null then load PSDlit into dat ... then do some checking,
+ # and return a data.frame with info for just that species/group
+ if (is.null(dat)) dat <- FSA::PSDlit
+ dat <- iPSDGetSpecies(dat,species,group)
- #====== Prepare Result as longs as PSDlit was not returned as NULL
- if (!is.null(PSDlit)) {
+ #====== Prepare Result as longs as dat was not returned as NULL
+ if (!is.null(dat)) {
if (showJustSource) {
ifelse(is.null(group),cols <- c(1,14),cols <- c(1,2,15))
- PSDlit[,cols]
+ dat[,cols]
} else {
#----- Identify columns based on units
ifelse(units=="in",cols <- 3:8,cols <- 9:14)
if (is.null(group)) cols <- cols-1
#----- get the length categories
- PSDvec <- as.matrix(PSDlit[,cols])[1,]
+ PSDvec <- as.matrix(dat[,cols])[1,]
names(PSDvec) <- gsub("\\..*","",names(PSDvec))
#----- remove zero category (substock) if asked
if (!incl.zero) PSDvec <- PSDvec[!names(PSDvec)=="substock"]
@@ -109,7 +118,6 @@ psdVal <- function(species="List",group=NULL,units=c("mm","cm","in"),
}
}
-
# ==============================================================================
# Internal -- check species name against the 'dat' data.frame (usually PSDLit)
# ==============================================================================
diff --git a/R/wrAdd.R b/R/wrAdd.R
index 22265c49..7f5a530e 100644
--- a/R/wrAdd.R
+++ b/R/wrAdd.R
@@ -6,6 +6,10 @@
#'
#' The species names in \code{species} must match the spelling and capitalization of \code{species} in \code{\link{WSlit}}. Use \code{wsVal()} to see a list of all species for which standard weight equations exist in \code{\link{WSlit}} and, more importantly, how the species names are spelled and capitalized.
#'
+#' The \code{thesaurus} argument may be used to relate alternate species names to the species names used in \code{WSlit}. For example, you (or your data) may use \dQuote{Bluegill Sunfish}, but \dQuote{Bluegill} is used in \code{WSlit}. The alternate species name can be used here if it is defined in a named vector (or list) given to \code{thesarus=}. The alternate species name is the value and the species name in \code{PSDlit} is the name in this vector/list - e.g., \code{c("Bluegill"="Bluegill Sunfish")}. See the examples for a demonstration.
+#'
+#' Some species have length categories separated by sub-group. For example, length categories exist for both lentic and lotic populations of Brown Trout. The length values for a sub-group may be obtained by either including the species name in \code{species} and the sub-group name in \code{group} in \code{WsOpts} or by using the combined species and sub-group name, with the sub-group name in parentheses, in \code{species}. Both methods are demonstrated in the examples. Note that an error is returned if a species has sub-groups but neither method is used to define the sub-group.
+#'
#' Some (few) species have more than one equation listed in \code{\link{WSlit}} (for the specified units). In these instances the user must select one of the equations to use with \code{WsOpts}. \code{WsOpts} is a list of lists where the inside list contains one or more of \code{group}, \code{ref}, or \code{method} (see \code{\link{WSlit}}) required to specify a single equation for a particular species, which is the name of the inner list. See the examples for an illustration of how to use \code{WsOpts}.
#'
#' See examples and \href{https://fishr-core-team.github.io/FSA/articles/Computing_Relative_Weights.html}{this article} for a demonstration.
@@ -14,6 +18,7 @@
#' @param len A numeric vector that contains length measurements. Not used if \code{wt} is a formula.
#' @param spec A character or factor vector that contains the species names. Not used if \code{wt} is a formula.
#' @param data A data.frame that minimally contains variables of the the observed lengths, observed weights, and the species names given in the \code{formula=}.
+#' @param thesaurus A named list for providing alternative species names (the values in the list) that correspond to specific names in \code{PSDlit} (the names in the list). See details and examples.
#' @param units A string that indicates whether the weight and length data in \code{formula} are in \code{"metric"} (DEFAULT; mm and g) or \code{"English"} (in and lbs) units.
#' @param WsOpts A named list that provides specific choices for \code{group}, \code{ref}, or \code{method} for species for which more than one standard weight equation exists in \code{\link{WSlit}}.
#' @param \dots Not used.
@@ -31,51 +36,78 @@
#' @keywords manip
#'
#' @examples
-#' #===== Create random data for three species
-#' #----- just to control the randomization
-#' set.seed(345234534)
-#' dbt <- data.frame(species=factor(rep(c("Bluefin Tuna"),30)),
-#' tl=round(rnorm(30,1900,300),0))
-#' dbt$wt <- round(4.5e-05*dbt$tl^2.8+rnorm(30,0,6000),1)
-#' dbg <- data.frame(species=factor(rep(c("Bluegill"),30)),
-#' tl=round(rnorm(30,130,50),0))
-#' dbg$wt <- round(4.23e-06*dbg$tl^3.316+rnorm(30,0,10),1)
-#' dlb <- data.frame(species=factor(rep(c("Largemouth Bass"),30)),
-#' tl=round(rnorm(30,350,60),0))
-#' dlb$wt <- round(2.96e-06*dlb$tl^3.273+rnorm(30,0,60),1)
-#' df <- rbind(dbt,dbg,dlb)
-#' str(df)
-#'
-#' #===== Add Wr variable
-#' #----- using formula interface
-#' df$Wr1 <- wrAdd(wt~tl+species,data=df)
+#' #===== Simple example with 3 species, 2 in WSlit ... nothing unusual
+#' tmp <- subset(PSDWRtest,
+#' species %in% c("Yellow Perch","Iowa Darter","Largemouth Bass"),
+#' select=c("species","len","wt"))
+#' peek(tmp,n=10)
#'
+#' #----- Add Wr variable ... using formula interface
+#' tmp$wr1 <- wrAdd(wt~len+species,data=tmp)
#' #----- same but with non-formula interface
-#' df$Wr2 <- wrAdd(df$wt,df$tl,df$species)
-#'
+#' tmp$wr2 <- wrAdd(tmp$wt,tmp$len,tmp$species)
#' #----- same but using dplyr
#' if (require(dplyr)) {
-#' df <- df %>%
-#' mutate(Wr3=wrAdd(wt,tl,species))
+#' tmp <- tmp %>%
+#' mutate(wr3=wrAdd(wt,len,species))
#' }
-#'
#' #----- examine results
-#' peek(df,n=10)
-#'
-#' #===== Example with only one species in the data.frame
-#' bg <- droplevels(subset(df,species=="Bluegill"))
-#' bg$Wr4 <- wrAdd(wt~tl+species,data=bg)
-#' bg
+#' peek(tmp,n=10)
+#'
+#' #===== Simple example with only one species in the data.frame
+#' tmp <- subset(PSDWRtest,species %in% c("Yellow Perch"),
+#' select=c("species","len","wt"))
+#' tmp$wr <- wrAdd(wt~len+species,data=tmp)
+#' peek(tmp,n=6)
+#'
+#' #===== Example of species with sub-groups but only 1 sub-group in data.frame
+#' #----- Group not in species name so must specify group with WsOpts
+#' tmp <- subset(PSDWRtest,species=="Brown Trout" & location=="Trout Lake",
+#' select=c("species","len","wt"))
+#' tmp$wr1 <- wrAdd(wt~len+species,data=tmp,
+#' WsOpts=list("Brown Trout"=list("group"="lotic")))
+#'
+#' #----- Group in species name so don't specify group with WsOpts
+#' tmp$species2 <- "Brown Trout (lotic)"
+#' tmp$wr2 <- wrAdd(wt~len+species2,data=tmp) # note use of species2
+#'
+#' peek(tmp,n=6)
+#'
+#' #===== Example of species with sub-groups and 2 sub-groups in data.frame
+#' tmp <- subset(PSDWRtest,species=="Brown Trout",
+#' select=c("species","location","len","wt"))
+#' #----- Must create "species" with sub-groups in name
+#' #----- Many ways to do this, this is just one example for this case
+#' tmp$species2 <- ifelse(tmp$location=="Trout Lake",
+#' "Brown Trout (lotic)","Brown Trout (lentic)")
+#' tmp$wr <- wrAdd(wt~len+species2,data=tmp) # note use of species2
+#' peek(tmp,n=6)
#'
-#' #===== Example with a species that has Ws eqns for multiple groups and a
-#' # group needs to be specified with WsOpts
-#' wae <- data.frame(species=factor(rep(c("Walleye"),30)),
-#' tl=round(rnorm(30,500,200),0))
-#' wae$wt <- round(3.33e-06*wae$tl^3.16+rnorm(30,0,50),1)
-#' # wae$Wr <- wrAdd(wt~tl+species,data=wae) # will err b/c multiple groups
-#' wae$Wr <- wrAdd(wt~tl+species,data=wae,
-#' WsOpts=list(Walleye=list(group="overall")))
-#' peek(wae,n=10)
+#' #===== Example of a species name that needs the thesaurus
+#' tmp <- subset(PSDWRtest,species %in% c("Yellow Perch","Bluegill Sunfish"),
+#' select=c("species","len","wt"))
+#' #----- Below will not add wr for "Bluegill Sunfish" as not in WsLit ("Bluegill" is)
+#' tmp$wr1 <- wrAdd(wt~len+species,data=tmp)
+#' #----- Use thesaurus to identify "Bluegill Sunfish" as "Blueill
+#' tmp$wr2 <- wrAdd(wt~len+species,data=tmp,thesaurus=c("Bluegill"="Bluegill Sunfish"))
+#' peek(tmp,n=10)
+#'
+#' #===== Example of species that has Ws eqns for multiple reference values
+#' tmp <- subset(PSDWRtest,species=="Ruffe",select=c("species","len","wt"))
+#' #----- Below will err as Ruffe has Ws eqns for multiple reference values
+#' # tmp$wr <- wrAdd(wt~len+species,data=tmp)
+#' #----- Must choose which eqn to use with WsOpts
+#' tmp$wr <- wrAdd(wt~len+species,data=tmp,
+#' WsOpts=list(Ruffe=list(ref=75)))
+#' peek(tmp,n=6)
+#'
+#' #===== Example with two uses of WsOpts (and one species without)
+#' tmp <- subset(PSDWRtest,species %in% c("Ruffe","Muskellunge","Iowa Darter"),
+#' select=c("species","len","wt"))
+#' tmp$wr <- wrAdd(wt~len+species,data=tmp,
+#' WsOpts=list(Muskellunge=list(group="overall"),
+#' Ruffe=list(ref=75)))
+#' peek(tmp,n=10)
#'
#' @rdname wrAdd
#' @export
@@ -85,7 +117,7 @@ wrAdd <- function (wt,...) {
#' @rdname wrAdd
#' @export
-wrAdd.default <- function(wt,len,spec,
+wrAdd.default <- function(wt,len,spec,thesaurus=NULL,
units=c("metric","English"),WsOpts=NULL,...) {
###### Internal Function
#===== Print error if no options given, but they are needed
@@ -94,7 +126,7 @@ wrAdd.default <- function(wt,len,spec,
print(df[,c("species","group","ref","method")])
#----- Error message for next two possible problems
STOP("More than one Ws equation exists for ",iStrCollapse(unique(df$species)),
- ". Please use a named list in 'opts=' to select one ",
+ ". Please use a named list in 'WsOpts=' to select one ",
"equation for ",iStrCollapse(unique(df$species))," by specifing 'group', ",
"'ref', or 'method' as appropriate. See details in documentation ",
"and above (for reference).")
@@ -107,7 +139,7 @@ wrAdd.default <- function(wt,len,spec,
#----- Reduce Wsdf to just for that species
Wsdf <- droplevels(Wsdf[Wsdf$species==species,])
#----- If >1 Ws eqn for species/units, then need user to further define
- # with opts, otherise one Ws eqn is returned
+ # with opts, otherwise one Ws eqn is returned
if (nrow(Wsdf)>1) {
# ..... Need opts for species but none given (at all) so STOP
if (is.null(WsOpts)) iErrOpts(Wsdf)
@@ -126,8 +158,8 @@ wrAdd.default <- function(wt,len,spec,
Wsdf <- droplevels(Wsdf[Wsdf[[names(tmp)]]==tmp,])
if (nrow(Wsdf)==0)
STOP("Use of '",crit_opts[i],"=",tmp[[1]],"' for ",iStrCollapse(species),
- " did not return a standard weight equation. Please reconsider your use ",
- "of 'WsOpts=' to restrict to only one equation for ",
+ " did not return a standard weight equation. Please reconsider your ",
+ "use of 'WsOpts=' to restrict to only one equation for ",
iStrCollapse(species),".")
else if (nrow(Wsdf)>1) {
#..... send error if not reduced to only one Ws equation
@@ -143,7 +175,6 @@ wrAdd.default <- function(wt,len,spec,
#----- Return appropriate part of Wsdf (i.e., WSlit)
Wsdf
}
-
###### END Internal Function
###### BEGIN Main Function
@@ -156,7 +187,7 @@ wrAdd.default <- function(wt,len,spec,
#===== Prepare the Ws literature values data frame
#----- load WSlit data frame into this functions environment
- WSlit <- FSA::WSlit
+ WSlit <- iPrepWSlit(thesaurus)
#----- isolate only those data for which those units exist
WSlit <- droplevels(WSlit[WSlit$units==units,])
@@ -166,8 +197,8 @@ wrAdd.default <- function(wt,len,spec,
Wr=rep(NA,length(len)))
#===== Initiate a blank new data frame with same columns as old data frame
ndata <- data[-c(seq_len(nrow(data))),]
- #===== get list of species in data
- specs <- unique(spec)
+ #===== get list of species in data ... change from factor to character if necessary
+ specs <- as.character(unique(spec))
#===== cycle through each species where WS equations are known
for (i in seq_along(specs)) {
@@ -199,7 +230,7 @@ wrAdd.default <- function(wt,len,spec,
#' @rdname wrAdd
#' @export
-wrAdd.formula <- function(wt,data,units=c("metric","English"),...) {
+wrAdd.formula <- function(wt,data,thesaurus=NULL,units=c("metric","English"),...) {
#===== Perform some checks on the formula
tmp <- iHndlFormula(wt,data,expNumR=1,expNumE=2,expNumENums=1,expNumEFacts=1)
if (tmp$vnum!=3) STOP("'wt' must have one variable on the left-hand-side ",
@@ -215,5 +246,44 @@ wrAdd.formula <- function(wt,data,units=c("metric","English"),...) {
#===== Call the wrAdd.default
wrAdd.default(tmp$mf[,tmp$Rpos],tmp$mf[,tmp$ENumPos],
- tmp$mf[,tmp$EFactPos],units,...)
+ tmp$mf[,tmp$EFactPos],thesaurus,units,...)
}
+
+# ==============================================================================
+# Internal -- prepare WSlit by loading it and replacing its default names with
+# names in the thesaurus, if any
+# ==============================================================================
+iPrepWSlit <- function(thesaurus) {
+ # Load WSlit into dat in this function namespace
+ dat <- FSA::WSlit
+ if (!is.null(thesaurus)) {
+ # Some sanity checks on thesaurus
+ if (!(is.vector(thesaurus) | is.list(thesaurus)))
+ STOP("'thesaurus' must be either a vector or list. ",
+ "Make sure it is not 'factor'ed.")
+ if (length(names(thesaurus))==0)
+ STOP("Values in 'thesaurus' must be named (with species names from 'WSlit'.)")
+ if (!is.character(thesaurus))
+ STOP("Values in 'thesaurus' must be strings of species names.")
+ # thesaurus appears to be a named vector/list of strings ... start processing
+ # Alphabetize names in thesaurus to match dat/WSlit
+ thesaurus <- thesaurus[order(names(thesaurus))]
+ # Remove name from thesaurus if not in dat/WSlit
+ thes.nokeep <- which(!names(thesaurus) %in% unique(dat$species))
+ if (length(thes.nokeep)>0) {
+ MESSAGE("The following species names were in 'thesaurus' but do ",
+ "not have an entry in 'WSlit' and will be ignored: ",
+ iStrCollapse(names(thesaurus)[thes.nokeep]),".")
+ thesaurus <- thesaurus[-thes.nokeep]
+ }
+ # Find species in dat/PSDlit in kept thesaurus and change names to thesaurus names
+ if (length(thesaurus)>0) {
+ tmp <- match(dat$species,names(thesaurus))
+ thes.pos <- which(!is.na(tmp))
+ dat$species[thes.pos] <- unname(thesaurus[tmp[thes.pos]])
+ }
+ }
+ # Return dat/WSlit
+ dat
+}
+
diff --git a/R/wsVal.R b/R/wsVal.R
index 87a8801b..dba9b5e2 100644
--- a/R/wsVal.R
+++ b/R/wsVal.R
@@ -10,6 +10,8 @@
#'
#' Note from above that the coefficients are returned for the TRANSFORMED model. Thus, to obtain the standard weight (Ws), the returned coefficients are used to compute the common log of Ws which must then be raised to the power of 10 to compute the Ws.
#'
+#' Some species have length categories separated by sub-group. For example, length categories exist for both lentic and lotic populations of Brown Trout. The length values for a sub-group may be obtained by either including the species name in \code{species} and the sub-group name in \code{group} or by using the combined species and sub-group name, with the sub-group name in parentheses, in \code{species}. Both methods are demonstrated in the examples. Note that an error is returned if a species has sub-groups but neither method is used to define the sub-group.
+#'
#' See examples and \href{https://fishr-core-team.github.io/FSA/articles/Computing_Relative_Weights.html}{this article} for a demonstration.
#'
#' @param species A string that contains the species name for which to find Ws coefficients. See details.
@@ -18,6 +20,7 @@
#' @param ref A numeric that indicates which percentile the equation should be returned for. Note that the vast majority of equations only exist for the \code{75}th percentile (DEFAULT).
#' @param method A string that indicates which equation-derivation method should be used (one of \code{"RLP"}, \code{"EmP"}, or \code{"Other"}). Defaults to \code{NULL} which will result in the only method available being returned or an error asking the user to choose a method for equations for which more than one method is available (which is the case for very few species).
#' @param simplify A logical that indicates whether the \sQuote{units}, \sQuote{ref}, \sQuote{measure}, \sQuote{method}, \sQuote{comments}, and \sQuote{source} fields should be included (\code{=FALSE}) or not (\code{=TRUE}; DEFAULT). See details.
+#' @param dat Data.frame of Gabelhouse length categories for all species. Defaults to `WSlit` and is generally not used by the user (this simplifies use of this function in \code{wrAdd}).
#'
#' @return A one row data frame from \code{\link{WSlit}} that contains all known information about the standard weight equation for a given species, type of measurement units, and reference percentile if \code{simplify=FALSE}. If \code{simplify=TRUE} then only the species; minimum and maximum length for which the standard equation should be applied; and intercept, slope, and quadratic coefficients for the standard weight equation. Note that the maximum length and the quadratic coefficient will not be returned if they do not exist in \code{\link{WSlit}} for the species.
#'
@@ -37,90 +40,91 @@
#' #===== List all available Ws equations
#' wsVal()
#'
-#' #===== Find equations for Bluegill, in different formats
-#' wsVal("Bluegill")
-#' wsVal("Bluegill",units="metric")
-#' wsVal("Bluegill",units="English")
-#' wsVal("Bluegill",units="English",simplify=TRUE)
-#'
-#' #===== Find equation for Cutthroat Trout, demonstrating use of group
-#' wsVal("Cutthroat Trout",group="lotic")
-#' wsVal("Cutthroat Trout",group="lentic")
+#' #===== Find equations for Yellow Perch, in different formats
+#' wsVal("Yellow Perch")
+#' wsVal("Yellow Perch",units="metric") # same as default
+#' wsVal("Yellow Perch",units="English")
+#' wsVal("Yellow Perch",units="English",simplify=TRUE)
#'
#' #===== Find equation for Ruffe, demonstrating quadratic formula
#' wsVal("Ruffe",units="metric",ref=75,simplify=TRUE)
#' wsVal("Ruffe",units="metric",ref=50,simplify=TRUE)
#'
+#' #===== Find equation for Brown Trout, which has equations for sub-groups
+#' #----- demonstrating use of group= argument
+#' wsVal("Brown Trout",group="lotic")
+#' wsVal("Brown Trout",group="lentic")
+#' #----- demonstrating group combined in species name, so no group= arg
+#' wsVal("Brown Trout (lotic)")
+#' wsVal("Brown Trout (lentic)")
+#'
#' #===== Add Ws & Wr values to a data frame (for one species) ... also see wrAdd()
-#' #----- Get Ws equation info
-#' wsBG <- wsVal("Bluegill",units="metric")
-#' wsBG
+#' #----- Example data from PSDWRtest, simplify variables for this example
+#' yepdf <- subset(PSDWRtest,species=="Yellow Perch",select=c("species","len","wt"))
+#' str(yepdf)
#'
-#' #----- Get example data
-#' data(BluegillLM,package="FSAdata")
-#' str(BluegillLM)
+#' #----- Get Ws equation info
+#' ( wsYEP <- wsVal("Yellow Perch",units="metric") )
#'
-#' #----- Add Ws (eqn is on log10-log10 scale ... so log10 len, 10^ result)
-#' BluegillLM$ws <- 10^(wsBG[["int"]]+wsBG[["slope"]]*log10(BluegillLM$tl))
+#' #----- Add Ws (eqn is on log10-log10 scale ... so log10 length, 10^ result)
+#' yepdf$ws <- 10^(wsYEP[["int"]]+wsYEP[["slope"]]*log10(yepdf$len))
#'
#' #----- Change Ws for fish less than min.TL to NA
-#' BluegillLM$ws[BluegillLM$tl
histStack(): Deleted, moved to plotrix package. Arguments were changed there.
ks2d(): Deleted, changed to ks2d2().
ks2d1(): Added.
ks2d2(): Added, was ks2d().
cat() to using message() so that they can be suppressed with suppressMessage() or message=FALSE in knitr. See “One comment on messages” at http://yihui.name/knitr/demo/output/.
pkolgomorov1x(): Added to FSAinternals (from ks2d()).
plotH(): Deleted, moved to plotrix package.
plotH(): Deleted, moved to plotrix package.
quad_dens(): Added to FSAinternals (from ks2d()).
confint.nlsBoot(): Removed use of %nin%.
discharge(): Deleted, moved to NCStats (to reduce overhead here).
histStack(): Modified by adding a formula method (histStack.formula()) which required adding a default method (histStack.default()).
histStack(): Modified by adding a formula method (histStack.formula()) which required adding a default method (histStack.default()).
htest.nlsBoot(): Removed use of %nin%.
lencat(): Modified by changing to using a formula notation and a data= argument. This means that the df= and cl= arguments are no longer used. In addition, the warning about fish larger than the larger category has been turned off. The method to handle this was not changed, the warning was just turned off.
lencatOLD(): Added as an internal file to temporarily allow me not to change all functions that were affected by the changes to lencat(). The functions that required this are emp() and wsValidate().
FroeseWs(): modified class name to “FroeseWs” from “FROESE”.
histStack(): added.
histStack(): added.
hoCoef(): added from NCStats.
ks2d(): modified class name to “ks2d” from “ks2d”.
ks2dp(): modified class name to “ks2dp” from “ks2dp”.
mrOpen(): modified class name to “mrOpen” from “MRO”.
plotBinResp(): added from NCStats.
plotH(): minor modifications to the Rd file.
plotH(): minor modifications to the Rd file.
pos2adj(): modified the labels for the positions by including full names for all directions, eliminating the single letters for the four main directions, but also leaving the four “off” directions as abbreviations.
psdVal(), rsdVal(), rsdCalc(), rsdPlot(): modified to use capFirst so that the user does not need to focus on capitalization of the species name.
removal(): modified class name to “removal” from “Removal”.
`lsmean(), and related internals: moved from NCStats.
mrClosed(): modified so as not to depend on ci.t() from NCStats.
plotH(): moved from NCStats.
plotH(): moved from NCStats.
poiCI(): moved from NCStats.
popSizesPlot(): moved from NCStats.
pos2adj(): moved from NCStats.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/BrookTroutTH-1.png b/docs/reference/BrookTroutTH-1.png index ab23868f..c44a173d 100644 Binary files a/docs/reference/BrookTroutTH-1.png and b/docs/reference/BrookTroutTH-1.png differ diff --git a/docs/reference/BrookTroutTH.html b/docs/reference/BrookTroutTH.html index 890fa8eb..8da1bce5 100644 --- a/docs/reference/BrookTroutTH.html +++ b/docs/reference/BrookTroutTH.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/ChinookArg-1.png b/docs/reference/ChinookArg-1.png index f8b16e3d..94c0d5f6 100644 Binary files a/docs/reference/ChinookArg-1.png and b/docs/reference/ChinookArg-1.png differ diff --git a/docs/reference/ChinookArg.html b/docs/reference/ChinookArg.html index 5581290a..94f7b806 100644 --- a/docs/reference/ChinookArg.html +++ b/docs/reference/ChinookArg.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/CodNorwegian-1.png b/docs/reference/CodNorwegian-1.png index df3f297e..46baf81c 100644 Binary files a/docs/reference/CodNorwegian-1.png and b/docs/reference/CodNorwegian-1.png differ diff --git a/docs/reference/CodNorwegian.html b/docs/reference/CodNorwegian.html index 8a1db6d1..2c491e7f 100644 --- a/docs/reference/CodNorwegian.html +++ b/docs/reference/CodNorwegian.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/CutthroatAL.html b/docs/reference/CutthroatAL.html index 820f8755..f1f47aba 100644 --- a/docs/reference/CutthroatAL.html +++ b/docs/reference/CutthroatAL.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/Ecoli.html b/docs/reference/Ecoli.html index f4cfed75..36baf56d 100644 --- a/docs/reference/Ecoli.html +++ b/docs/reference/Ecoli.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/PSDlit.html b/docs/reference/PSDlit.html index 551af2a2..b83339f1 100644 --- a/docs/reference/PSDlit.html +++ b/docs/reference/PSDlit.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Original summary table from Dr. Michael Hansen, University of Wisconsin-Stevens Point. Additional species have been added by the package author from the literature.
Entries for some species (e.g., “Muskellunge” and “Walleye”) have been duplicated for sub-groups to facilitate use with relative weight calculations. For example, entries for “Muskellunge (overall)”, “Muskellunge (female)”, and “Muskellunge (male)” are duplicates of the entry for “Muskellunge”; i.e., these entries in PSDlit are not necessarily just for those sub-groups but this allows for seamless similar computations of relative weights for these sub-groups.
str(PSDlit)
-#> 'data.frame': 72 obs. of 15 variables:
-#> $ species : chr "Arctic Grayling" "Bighead Carp" "Bigmouth Buffalo" "Black Bullhead" ...
+#> 'data.frame': 96 obs. of 15 variables:
+#> $ species : chr "Alabama Bass" "Arctic Grayling" "Bighead Carp" "Bigmouth Buffalo" ...
#> $ group : chr NA NA NA NA ...
#> $ substock.in : int 0 0 0 0 0 0 0 0 0 0 ...
-#> $ stock.in : num 8 11.8 11 6 15.8 ...
-#> $ quality.in : num 12 21.2 18 9 28.2 ...
-#> $ preferred.in: num 16 26.8 24 12 35.5 ...
-#> $ memorable.in: num 20 35 30 15 46.5 12 35 10 20 NA ...
-#> $ trophy.in : num 22 43.8 37 18 58.2 ...
+#> $ stock.in : num 7 8 11.8 11 6 ...
+#> $ quality.in : num 11 12 21.2 18 9 ...
+#> $ preferred.in: num 14 16 26.8 24 12 ...
+#> $ memorable.in: num 17 20 35 30 15 46.5 12 35 10 20 ...
+#> $ trophy.in : num 20 22 43.8 37 18 ...
#> $ substock.cm : int 0 0 0 0 0 0 0 0 0 0 ...
-#> $ stock.cm : num 20 30 28 15 40 13 30 8 20 20 ...
-#> $ quality.cm : int 30 54 46 23 72 20 51 15 30 33 ...
-#> $ preferred.cm: int 40 68 61 30 90 25 76 20 40 NA ...
-#> $ memorable.cm: int 50 89 76 39 118 30 89 25 50 NA ...
-#> $ trophy.cm : num 55 111 94 46 148 38 114 30 60 NA ...
-#> $ source : chr "Hyatt (2000)" "Phelps and Willis (2013)" "Bister et al. (2000)" "Gabelhouse (1984a)" ...
+#> $ stock.cm : num 18 20 30 28 15 40 13 30 8 20 ...
+#> $ quality.cm : int 28 30 54 46 23 72 20 51 15 30 ...
+#> $ preferred.cm: int 35 40 68 61 30 90 25 76 20 40 ...
+#> $ memorable.cm: int 43 50 89 76 39 118 30 89 25 50 ...
+#> $ trophy.cm : num 51 55 111 94 46 148 38 114 30 60 ...
+#> $ source : chr "Sammons et al. (2025)" "Hyatt (2000)" "Phelps and Willis (2013)" "Bister et al. (2000)" ...
head(PSDlit)
#> species group substock.in stock.in quality.in preferred.in
-#> 1 Arctic Grayling <NA> 0 8.00 12.00 16.00
-#> 2 Bighead Carp <NA> 0 11.75 21.25 26.75
-#> 3 Bigmouth Buffalo <NA> 0 11.00 18.00 24.00
-#> 4 Black Bullhead <NA> 0 6.00 9.00 12.00
-#> 5 Black Carp <NA> 0 15.75 28.25 35.50
-#> 6 Black Crappie <NA> 0 5.00 8.00 10.00
+#> 1 Alabama Bass <NA> 0 7.00 11.00 14.00
+#> 2 Arctic Grayling <NA> 0 8.00 12.00 16.00
+#> 3 Bighead Carp <NA> 0 11.75 21.25 26.75
+#> 4 Bigmouth Buffalo <NA> 0 11.00 18.00 24.00
+#> 5 Black Bullhead <NA> 0 6.00 9.00 12.00
+#> 6 Black Carp <NA> 0 15.75 28.25 35.50
#> memorable.in trophy.in substock.cm stock.cm quality.cm preferred.cm
-#> 1 20.0 22.00 0 20 30 40
-#> 2 35.0 43.75 0 30 54 68
-#> 3 30.0 37.00 0 28 46 61
-#> 4 15.0 18.00 0 15 23 30
-#> 5 46.5 58.25 0 40 72 90
-#> 6 12.0 15.00 0 13 20 25
+#> 1 17.0 20.00 0 18 28 35
+#> 2 20.0 22.00 0 20 30 40
+#> 3 35.0 43.75 0 30 54 68
+#> 4 30.0 37.00 0 28 46 61
+#> 5 15.0 18.00 0 15 23 30
+#> 6 46.5 58.25 0 40 72 90
#> memorable.cm trophy.cm source
-#> 1 50 55 Hyatt (2000)
-#> 2 89 111 Phelps and Willis (2013)
-#> 3 76 94 Bister et al. (2000)
-#> 4 39 46 Gabelhouse (1984a)
-#> 5 118 148 Phelps and Willis (2013)
-#> 6 30 38 Gabelhouse (1984a)
+#> 1 43 51 Sammons et al. (2025)
+#> 2 50 55 Hyatt (2000)
+#> 3 89 111 Phelps and Willis (2013)
+#> 4 76 94 Bister et al. (2000)
+#> 5 39 46 Gabelhouse (1984a)
+#> 6 118 148 Phelps and Willis (2013)
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/PikeNY.html b/docs/reference/PikeNY.html index 1946c8c8..768bbc65 100644 --- a/docs/reference/PikeNY.html +++ b/docs/reference/PikeNY.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/PikeNYPartial1.html b/docs/reference/PikeNYPartial1.html index 67ba1f7a..55b66c7f 100644 --- a/docs/reference/PikeNYPartial1.html +++ b/docs/reference/PikeNYPartial1.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/SMBassLS.html b/docs/reference/SMBassLS.html index 2f136249..67ffcd43 100644 --- a/docs/reference/SMBassLS.html +++ b/docs/reference/SMBassLS.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/SMBassWB.html b/docs/reference/SMBassWB.html index 57dc868f..7460f2a7 100644 --- a/docs/reference/SMBassWB.html +++ b/docs/reference/SMBassWB.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/SpotVA1-1.png b/docs/reference/SpotVA1-1.png index 28801cb1..65f938f8 100644 Binary files a/docs/reference/SpotVA1-1.png and b/docs/reference/SpotVA1-1.png differ diff --git a/docs/reference/SpotVA1.html b/docs/reference/SpotVA1.html index ba92dc2b..01ad5462 100644 --- a/docs/reference/SpotVA1.html +++ b/docs/reference/SpotVA1.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/Summarize.html b/docs/reference/Summarize.html index 1dbf2f27..e706bf3a 100644 --- a/docs/reference/Summarize.html +++ b/docs/reference/Summarize.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/WR79.html b/docs/reference/WR79.html index b59bb79b..51251277 100644 --- a/docs/reference/WR79.html +++ b/docs/reference/WR79.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/WSlit.html b/docs/reference/WSlit.html index bb4009e6..f8a83b55 100644 --- a/docs/reference/WSlit.html +++ b/docs/reference/WSlit.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1The minimum TL for the English units were derived by rounding the converted minimum TL for the metric units to what seemed like common units (inches, half inches, or quarter inches).
+Entries for “Chinook Salmon (landlocked)” and “Striped Bass (landlocked)” are the same as for “Chinook Salmon” and “Striped Bass” but were added to facilitate use with PSD calculations as Gabelhouse lengths are only published for the landlocked sub-group; i.e., these entries in WSlit are not necessarily just for landlocked populations.
str(WSlit)
-#> 'data.frame': 207 obs. of 13 variables:
-#> $ species: chr "Aegean Chub" "African Sharptooth Catfish" "Alabama Bass" "Ankara Nase" ...
+#> 'data.frame': 257 obs. of 13 variables:
+#> $ species: chr "Aegean Chub" "African Sharptooth Catfish" "Alabama Bass" "Alabama Bass" ...
#> $ group : chr NA NA NA NA ...
#> $ measure: chr "TL" "TL" "TL" "TL" ...
-#> $ units : chr "metric" "metric" "metric" "metric" ...
-#> $ ref : int 75 75 75 75 75 75 50 75 75 25 ...
-#> $ method : chr "EmP" "EmP" "RLP" "EmP" ...
-#> $ min.len: num 70 180 100 70 150 150 160 6 150 70 ...
-#> $ max.len: num 220 450 NA 240 NA NA NA NA NA 390 ...
-#> $ int : num -3.8 -3.67 -5.6 -10.02 -5.24 ...
-#> $ slope : num 1.78 1.88 3.29 7.4 3.08 ...
-#> $ quad : num 0.329 0.209 NA -0.971 NA ...
-#> $ source : chr "Giannetto et al. (2012)" "Emiroglu et al. (2018)" "Dicenzo et al. (1995)" "Emiroglu et al. (2020)" ...
-#> $ comment: chr "none" "only from Sakarya River Basin (Turkey)" "min.len not made clear (assumed same as Spotted Bass); same as Spotted Bass (Alabama subspecies)" "only from Turkey" ...
+#> $ units : chr "metric" "metric" "metric" "English" ...
+#> $ ref : int 75 75 75 75 75 75 75 75 50 75 ...
+#> $ method : chr "EmP" "EmP" "EmP" "EmP" ...
+#> $ min.len: num 70 180 150 6 100 70 150 150 160 6 ...
+#> $ max.len: num 220 450 550 22 NA 240 NA NA NA NA ...
+#> $ int : num -3.8 -3.67 -5.62 -3.53 -5.6 ...
+#> $ slope : num 1.78 1.88 3.28 3.17 3.29 ...
+#> $ quad : num 0.329 0.209 NA NA NA ...
+#> $ source : chr "Giannetto et al. (2012)" "Emiroglu et al. (2018)" "Sammons et al. (2025)" "Sammons et al. (2025)" ...
+#> $ comment: chr "none" "only from Sakarya River Basin (Turkey)" "RLP and EmP (quadratic) models not recommended" "RLP and EmP (quadratic) models not recommended" ...
head(WSlit)
-#> species group measure units ref method min.len max.len
-#> 1 Aegean Chub <NA> TL metric 75 EmP 70 220
-#> 2 African Sharptooth Catfish <NA> TL metric 75 EmP 180 450
-#> 3 Alabama Bass <NA> TL metric 75 RLP 100 NA
-#> 4 Ankara Nase <NA> TL metric 75 EmP 70 240
-#> 5 Arctic Grayling <NA> TL metric 75 RLP 150 NA
-#> 6 Arctic Grayling <NA> TL metric 75 EmP 150 NA
-#> int slope quad source
-#> 1 -3.801 1.7830 0.3290 Giannetto et al. (2012)
-#> 2 -3.668 1.8850 0.2087 Emiroglu et al. (2018)
-#> 3 -5.598 3.2904 NA Dicenzo et al. (1995)
-#> 4 -10.017 7.4020 -0.9710 Emiroglu et al. (2020)
-#> 5 -5.241 3.0830 NA Gilham et al. (2021)
-#> 6 -5.279 3.0960 NA Gilham et al. (2021)
-#> comment
-#> 1 none
-#> 2 only from Sakarya River Basin (Turkey)
-#> 3 min.len not made clear (assumed same as Spotted Bass); same as Spotted Bass (Alabama subspecies)
-#> 4 only from Turkey
-#> 5 authors note that either RLP or EmP method may be used
-#> 6 authors note that either RLP or EmP method may be used
+#> species group measure units ref method min.len max.len
+#> 1 Aegean Chub <NA> TL metric 75 EmP 70 220
+#> 2 African Sharptooth Catfish <NA> TL metric 75 EmP 180 450
+#> 3 Alabama Bass <NA> TL metric 75 EmP 150 550
+#> 4 Alabama Bass <NA> TL English 75 EmP 6 22
+#> 5 Alabama Bass (original) <NA> TL metric 75 RLP 100 NA
+#> 6 Ankara Nase <NA> TL metric 75 EmP 70 240
+#> int slope quad source
+#> 1 -3.8010 1.7830 0.3290 Giannetto et al. (2012)
+#> 2 -3.6680 1.8850 0.2087 Emiroglu et al. (2018)
+#> 3 -5.6189 3.2840 NA Sammons et al. (2025)
+#> 4 -3.5339 3.1750 NA Sammons et al. (2025)
+#> 5 -5.5980 3.2904 NA Dicenzo et al. (1995)
+#> 6 -10.0170 7.4020 -0.9710 Emiroglu et al. (2020)
+#> comment
+#> 1 none
+#> 2 only from Sakarya River Basin (Turkey)
+#> 3 RLP and EmP (quadratic) models not recommended
+#> 4 RLP and EmP (quadratic) models not recommended
+#> 5 HAS BEEN REVISED; min.len not made clear (assumed same as Spotted Bass)
+#> 6 only from Turkey
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/WhitefishLC.html b/docs/reference/WhitefishLC.html index 992bbeff..0642b078 100644 --- a/docs/reference/WhitefishLC.html +++ b/docs/reference/WhitefishLC.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/addZeroCatch.html b/docs/reference/addZeroCatch.html index bae27385..8deefc97 100644 --- a/docs/reference/addZeroCatch.html +++ b/docs/reference/addZeroCatch.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/ageBias-1.png b/docs/reference/ageBias-1.png index 5eccedaf..a50ed394 100644 Binary files a/docs/reference/ageBias-1.png and b/docs/reference/ageBias-1.png differ diff --git a/docs/reference/ageBias-10.png b/docs/reference/ageBias-10.png index 3330eae7..d675635a 100644 Binary files a/docs/reference/ageBias-10.png and b/docs/reference/ageBias-10.png differ diff --git a/docs/reference/ageBias-11.png b/docs/reference/ageBias-11.png index fbe96b15..bf24d59d 100644 Binary files a/docs/reference/ageBias-11.png and b/docs/reference/ageBias-11.png differ diff --git a/docs/reference/ageBias-12.png b/docs/reference/ageBias-12.png index be19d345..bea16923 100644 Binary files a/docs/reference/ageBias-12.png and b/docs/reference/ageBias-12.png differ diff --git a/docs/reference/ageBias-13.png b/docs/reference/ageBias-13.png index 541dd065..7d8861e4 100644 Binary files a/docs/reference/ageBias-13.png and b/docs/reference/ageBias-13.png differ diff --git a/docs/reference/ageBias-14.png b/docs/reference/ageBias-14.png index b94f21b6..efc241db 100644 Binary files a/docs/reference/ageBias-14.png and b/docs/reference/ageBias-14.png differ diff --git a/docs/reference/ageBias-15.png b/docs/reference/ageBias-15.png index d4ef27a1..c91491e8 100644 Binary files a/docs/reference/ageBias-15.png and b/docs/reference/ageBias-15.png differ diff --git a/docs/reference/ageBias-16.png b/docs/reference/ageBias-16.png index a404a913..f6466c7c 100644 Binary files a/docs/reference/ageBias-16.png and b/docs/reference/ageBias-16.png differ diff --git a/docs/reference/ageBias-17.png b/docs/reference/ageBias-17.png index 682ae900..b917c436 100644 Binary files a/docs/reference/ageBias-17.png and b/docs/reference/ageBias-17.png differ diff --git a/docs/reference/ageBias-18.png b/docs/reference/ageBias-18.png index 5b63f228..2e6521d3 100644 Binary files a/docs/reference/ageBias-18.png and b/docs/reference/ageBias-18.png differ diff --git a/docs/reference/ageBias-19.png b/docs/reference/ageBias-19.png index 36889422..f605a78e 100644 Binary files a/docs/reference/ageBias-19.png and b/docs/reference/ageBias-19.png differ diff --git a/docs/reference/ageBias-2.png b/docs/reference/ageBias-2.png index 16253975..4cdac660 100644 Binary files a/docs/reference/ageBias-2.png and b/docs/reference/ageBias-2.png differ diff --git a/docs/reference/ageBias-20.png b/docs/reference/ageBias-20.png index d3a18ab2..508cc116 100644 Binary files a/docs/reference/ageBias-20.png and b/docs/reference/ageBias-20.png differ diff --git a/docs/reference/ageBias-21.png b/docs/reference/ageBias-21.png index 5d964457..4f2eeca5 100644 Binary files a/docs/reference/ageBias-21.png and b/docs/reference/ageBias-21.png differ diff --git a/docs/reference/ageBias-22.png b/docs/reference/ageBias-22.png index 51b697f0..2b00b41d 100644 Binary files a/docs/reference/ageBias-22.png and b/docs/reference/ageBias-22.png differ diff --git a/docs/reference/ageBias-3.png b/docs/reference/ageBias-3.png index 1b7e6eef..4c227147 100644 Binary files a/docs/reference/ageBias-3.png and b/docs/reference/ageBias-3.png differ diff --git a/docs/reference/ageBias-4.png b/docs/reference/ageBias-4.png index e6d98edb..392c2e11 100644 Binary files a/docs/reference/ageBias-4.png and b/docs/reference/ageBias-4.png differ diff --git a/docs/reference/ageBias-5.png b/docs/reference/ageBias-5.png index 41b5d0be..eefa40c4 100644 Binary files a/docs/reference/ageBias-5.png and b/docs/reference/ageBias-5.png differ diff --git a/docs/reference/ageBias-6.png b/docs/reference/ageBias-6.png index b14ebcd0..618462e7 100644 Binary files a/docs/reference/ageBias-6.png and b/docs/reference/ageBias-6.png differ diff --git a/docs/reference/ageBias-7.png b/docs/reference/ageBias-7.png index 5af5d167..72ddc68d 100644 Binary files a/docs/reference/ageBias-7.png and b/docs/reference/ageBias-7.png differ diff --git a/docs/reference/ageBias-8.png b/docs/reference/ageBias-8.png index 7180dfbb..495d0b93 100644 Binary files a/docs/reference/ageBias-8.png and b/docs/reference/ageBias-8.png differ diff --git a/docs/reference/ageBias-9.png b/docs/reference/ageBias-9.png index 554f21fd..ce4c496c 100644 Binary files a/docs/reference/ageBias-9.png and b/docs/reference/ageBias-9.png differ diff --git a/docs/reference/ageBias.html b/docs/reference/ageBias.html index 34a19977..3dec286f 100644 --- a/docs/reference/ageBias.html +++ b/docs/reference/ageBias.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1A numeric that controls the separate ‘sfrac’ arguments (e.g., sfrac.CI and sfrac.range). See sfrac in plotCI of plotrix.
A numeric that controls the separate ‘sfrac’ arguments (e.g., sfrac.CI and sfrac.range). See sfrac in plotCI of plotrix.
A numeric for the size of the ends of the confidence interval bars. See sfrac in plotCI of plotrix.
A numeric for the size of the ends of the confidence interval bars. See sfrac in plotCI of plotrix.
A numeric for the size of the ends of the range intervals. See sfrac in plotCI of plotrix.
A numeric for the size of the ends of the range intervals. See sfrac in plotCI of plotrix.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/agePrecision-1.png b/docs/reference/agePrecision-1.png index dc8d50e0..9c4c79cc 100644 Binary files a/docs/reference/agePrecision-1.png and b/docs/reference/agePrecision-1.png differ diff --git a/docs/reference/agePrecision-10.png b/docs/reference/agePrecision-10.png index f9829e17..6a2d9402 100644 Binary files a/docs/reference/agePrecision-10.png and b/docs/reference/agePrecision-10.png differ diff --git a/docs/reference/agePrecision-2.png b/docs/reference/agePrecision-2.png index 8fda040f..d915dc1f 100644 Binary files a/docs/reference/agePrecision-2.png and b/docs/reference/agePrecision-2.png differ diff --git a/docs/reference/agePrecision-3.png b/docs/reference/agePrecision-3.png index ce32e0d2..79a110e5 100644 Binary files a/docs/reference/agePrecision-3.png and b/docs/reference/agePrecision-3.png differ diff --git a/docs/reference/agePrecision-4.png b/docs/reference/agePrecision-4.png index 94e19e75..f2189685 100644 Binary files a/docs/reference/agePrecision-4.png and b/docs/reference/agePrecision-4.png differ diff --git a/docs/reference/agePrecision-5.png b/docs/reference/agePrecision-5.png index 84e216c1..ccb7be9d 100644 Binary files a/docs/reference/agePrecision-5.png and b/docs/reference/agePrecision-5.png differ diff --git a/docs/reference/agePrecision-6.png b/docs/reference/agePrecision-6.png index fea8a587..32ac0872 100644 Binary files a/docs/reference/agePrecision-6.png and b/docs/reference/agePrecision-6.png differ diff --git a/docs/reference/agePrecision-7.png b/docs/reference/agePrecision-7.png index 9293cc8e..77ff05bb 100644 Binary files a/docs/reference/agePrecision-7.png and b/docs/reference/agePrecision-7.png differ diff --git a/docs/reference/agePrecision-8.png b/docs/reference/agePrecision-8.png index d6eeb138..fad4c308 100644 Binary files a/docs/reference/agePrecision-8.png and b/docs/reference/agePrecision-8.png differ diff --git a/docs/reference/agePrecision-9.png b/docs/reference/agePrecision-9.png index 784d9c59..dda26b9b 100644 Binary files a/docs/reference/agePrecision-9.png and b/docs/reference/agePrecision-9.png differ diff --git a/docs/reference/agePrecision.html b/docs/reference/agePrecision.html index d586b204..ca672fe8 100644 --- a/docs/reference/agePrecision.html +++ b/docs/reference/agePrecision.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1
@@ -612,162 +880,310 @@ Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/alkAgeDist.html b/docs/reference/alkAgeDist.html index bfd6f3e5..3ab44115 100644 --- a/docs/reference/alkAgeDist.html +++ b/docs/reference/alkAgeDist.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/alkIndivAge.html b/docs/reference/alkIndivAge.html index 36016b55..ad65ce2c 100644 --- a/docs/reference/alkIndivAge.html +++ b/docs/reference/alkIndivAge.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/alkMeanVar.html b/docs/reference/alkMeanVar.html index c388e9b2..4d64e0be 100644 --- a/docs/reference/alkMeanVar.html +++ b/docs/reference/alkMeanVar.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/alkPlot-1.png b/docs/reference/alkPlot-1.png index e1cc6d6e..2a1fc60d 100644 Binary files a/docs/reference/alkPlot-1.png and b/docs/reference/alkPlot-1.png differ diff --git a/docs/reference/alkPlot-10.png b/docs/reference/alkPlot-10.png index be9aed3a..fe88d95a 100644 Binary files a/docs/reference/alkPlot-10.png and b/docs/reference/alkPlot-10.png differ diff --git a/docs/reference/alkPlot-2.png b/docs/reference/alkPlot-2.png index 7ed9beb7..a2f5d519 100644 Binary files a/docs/reference/alkPlot-2.png and b/docs/reference/alkPlot-2.png differ diff --git a/docs/reference/alkPlot-3.png b/docs/reference/alkPlot-3.png index 9d936d80..ab6e6842 100644 Binary files a/docs/reference/alkPlot-3.png and b/docs/reference/alkPlot-3.png differ diff --git a/docs/reference/alkPlot-4.png b/docs/reference/alkPlot-4.png index 9495a00a..980fe8f6 100644 Binary files a/docs/reference/alkPlot-4.png and b/docs/reference/alkPlot-4.png differ diff --git a/docs/reference/alkPlot-5.png b/docs/reference/alkPlot-5.png index ce56e18e..27c3d6d4 100644 Binary files a/docs/reference/alkPlot-5.png and b/docs/reference/alkPlot-5.png differ diff --git a/docs/reference/alkPlot-6.png b/docs/reference/alkPlot-6.png index b9924d67..38df5c88 100644 Binary files a/docs/reference/alkPlot-6.png and b/docs/reference/alkPlot-6.png differ diff --git a/docs/reference/alkPlot-7.png b/docs/reference/alkPlot-7.png index 1b1b9083..62d65d66 100644 Binary files a/docs/reference/alkPlot-7.png and b/docs/reference/alkPlot-7.png differ diff --git a/docs/reference/alkPlot-8.png b/docs/reference/alkPlot-8.png index c8e67965..85dc7340 100644 Binary files a/docs/reference/alkPlot-8.png and b/docs/reference/alkPlot-8.png differ diff --git a/docs/reference/alkPlot-9.png b/docs/reference/alkPlot-9.png index 22949976..e36d4756 100644 Binary files a/docs/reference/alkPlot-9.png and b/docs/reference/alkPlot-9.png differ diff --git a/docs/reference/alkPlot.html b/docs/reference/alkPlot.html index db3b9136..bf426cdf 100644 --- a/docs/reference/alkPlot.html +++ b/docs/reference/alkPlot.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/binCI.html b/docs/reference/binCI.html index cf341607..ff8c8066 100644 --- a/docs/reference/binCI.html +++ b/docs/reference/binCI.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/capHistConvert.html b/docs/reference/capHistConvert.html index 29d26879..ea5add01 100644 --- a/docs/reference/capHistConvert.html +++ b/docs/reference/capHistConvert.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/capHistSum-1.png b/docs/reference/capHistSum-1.png index 48bc9f24..3d3d305a 100644 Binary files a/docs/reference/capHistSum-1.png and b/docs/reference/capHistSum-1.png differ diff --git a/docs/reference/capHistSum-2.png b/docs/reference/capHistSum-2.png index fa3dc87b..0c0180e0 100644 Binary files a/docs/reference/capHistSum-2.png and b/docs/reference/capHistSum-2.png differ diff --git a/docs/reference/capHistSum-3.png b/docs/reference/capHistSum-3.png index 19bdbdcc..d481728a 100644 Binary files a/docs/reference/capHistSum-3.png and b/docs/reference/capHistSum-3.png differ diff --git a/docs/reference/capHistSum.html b/docs/reference/capHistSum.html index f9ea0855..2f9d5c4d 100644 --- a/docs/reference/capHistSum.html +++ b/docs/reference/capHistSum.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/catchCurve-1.png b/docs/reference/catchCurve-1.png index d080eeba..3ed5bf97 100644 Binary files a/docs/reference/catchCurve-1.png and b/docs/reference/catchCurve-1.png differ diff --git a/docs/reference/catchCurve-2.png b/docs/reference/catchCurve-2.png index dbf648bb..c07abcaf 100644 Binary files a/docs/reference/catchCurve-2.png and b/docs/reference/catchCurve-2.png differ diff --git a/docs/reference/catchCurve-3.png b/docs/reference/catchCurve-3.png index 7a322036..9f15d667 100644 Binary files a/docs/reference/catchCurve-3.png and b/docs/reference/catchCurve-3.png differ diff --git a/docs/reference/catchCurve-4.png b/docs/reference/catchCurve-4.png index 458c7ec1..a9b5d2d7 100644 Binary files a/docs/reference/catchCurve-4.png and b/docs/reference/catchCurve-4.png differ diff --git a/docs/reference/catchCurve-5.png b/docs/reference/catchCurve-5.png index 55a26405..c2063da1 100644 Binary files a/docs/reference/catchCurve-5.png and b/docs/reference/catchCurve-5.png differ diff --git a/docs/reference/catchCurve.html b/docs/reference/catchCurve.html index b57ff077..67b34c44 100644 --- a/docs/reference/catchCurve.html +++ b/docs/reference/catchCurve.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/chapmanRobson-1.png b/docs/reference/chapmanRobson-1.png index d080eeba..3ed5bf97 100644 Binary files a/docs/reference/chapmanRobson-1.png and b/docs/reference/chapmanRobson-1.png differ diff --git a/docs/reference/chapmanRobson-2.png b/docs/reference/chapmanRobson-2.png index 6de6be1d..2cf852eb 100644 Binary files a/docs/reference/chapmanRobson-2.png and b/docs/reference/chapmanRobson-2.png differ diff --git a/docs/reference/chapmanRobson-3.png b/docs/reference/chapmanRobson-3.png index 201fbd02..637ab656 100644 Binary files a/docs/reference/chapmanRobson-3.png and b/docs/reference/chapmanRobson-3.png differ diff --git a/docs/reference/chapmanRobson-4.png b/docs/reference/chapmanRobson-4.png index db7d565a..e3cfadf4 100644 Binary files a/docs/reference/chapmanRobson-4.png and b/docs/reference/chapmanRobson-4.png differ diff --git a/docs/reference/chapmanRobson-5.png b/docs/reference/chapmanRobson-5.png index 6de6be1d..2cf852eb 100644 Binary files a/docs/reference/chapmanRobson-5.png and b/docs/reference/chapmanRobson-5.png differ diff --git a/docs/reference/chapmanRobson-6.png b/docs/reference/chapmanRobson-6.png index c39069ba..d70f4c77 100644 Binary files a/docs/reference/chapmanRobson-6.png and b/docs/reference/chapmanRobson-6.png differ diff --git a/docs/reference/chapmanRobson.html b/docs/reference/chapmanRobson.html index 22f3f321..bc79f80a 100644 --- a/docs/reference/chapmanRobson.html +++ b/docs/reference/chapmanRobson.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/col2rgbt.html b/docs/reference/col2rgbt.html index e5e7ebe5..32885bfa 100644 --- a/docs/reference/col2rgbt.html +++ b/docs/reference/col2rgbt.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/depletion-1.png b/docs/reference/depletion-1.png index 281cd37c..a2bde566 100644 Binary files a/docs/reference/depletion-1.png and b/docs/reference/depletion-1.png differ diff --git a/docs/reference/depletion-2.png b/docs/reference/depletion-2.png index 7cb9de29..769312ec 100644 Binary files a/docs/reference/depletion-2.png and b/docs/reference/depletion-2.png differ diff --git a/docs/reference/depletion-3.png b/docs/reference/depletion-3.png index 07454464..45717e54 100644 Binary files a/docs/reference/depletion-3.png and b/docs/reference/depletion-3.png differ diff --git a/docs/reference/depletion.html b/docs/reference/depletion.html index 8017a865..81d3bcb7 100644 --- a/docs/reference/depletion.html +++ b/docs/reference/depletion.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/dunnTest.html b/docs/reference/dunnTest.html index edf40b9e..86dceddf 100644 --- a/docs/reference/dunnTest.html +++ b/docs/reference/dunnTest.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/expandCounts.html b/docs/reference/expandCounts.html index 4e83f083..e00e85f2 100644 --- a/docs/reference/expandCounts.html +++ b/docs/reference/expandCounts.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/expandLenFreq.html b/docs/reference/expandLenFreq.html index 03a5b09e..aff309a2 100644 --- a/docs/reference/expandLenFreq.html +++ b/docs/reference/expandLenFreq.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/extraTests.html b/docs/reference/extraTests.html index e14360ac..09ed0a4c 100644 --- a/docs/reference/extraTests.html +++ b/docs/reference/extraTests.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/fact2num.html b/docs/reference/fact2num.html index be9b0867..bf59ba15 100644 --- a/docs/reference/fact2num.html +++ b/docs/reference/fact2num.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/fishR.html b/docs/reference/fishR.html index 4bfcda63..d88d1a99 100644 --- a/docs/reference/fishR.html +++ b/docs/reference/fishR.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/geomean.html b/docs/reference/geomean.html index 76d9af7e..4c1a5b77 100644 --- a/docs/reference/geomean.html +++ b/docs/reference/geomean.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/growthModels-1.png b/docs/reference/growthModels-1.png index 899b161e..73fa6f22 100644 Binary files a/docs/reference/growthModels-1.png and b/docs/reference/growthModels-1.png differ diff --git a/docs/reference/growthModels-10.png b/docs/reference/growthModels-10.png index aae2813d..80bd9960 100644 Binary files a/docs/reference/growthModels-10.png and b/docs/reference/growthModels-10.png differ diff --git a/docs/reference/growthModels-11.png b/docs/reference/growthModels-11.png index 5fc16f99..75fb060d 100644 Binary files a/docs/reference/growthModels-11.png and b/docs/reference/growthModels-11.png differ diff --git a/docs/reference/growthModels-12.png b/docs/reference/growthModels-12.png index f5a214b6..7b59260d 100644 Binary files a/docs/reference/growthModels-12.png and b/docs/reference/growthModels-12.png differ diff --git a/docs/reference/growthModels-13.png b/docs/reference/growthModels-13.png index 739208f5..2ff2f907 100644 Binary files a/docs/reference/growthModels-13.png and b/docs/reference/growthModels-13.png differ diff --git a/docs/reference/growthModels-2.png b/docs/reference/growthModels-2.png index 90232f5c..2446fa4a 100644 Binary files a/docs/reference/growthModels-2.png and b/docs/reference/growthModels-2.png differ diff --git a/docs/reference/growthModels-3.png b/docs/reference/growthModels-3.png index 15be7fdc..fb0ef4c3 100644 Binary files a/docs/reference/growthModels-3.png and b/docs/reference/growthModels-3.png differ diff --git a/docs/reference/growthModels-4.png b/docs/reference/growthModels-4.png index 4aac9052..1240d885 100644 Binary files a/docs/reference/growthModels-4.png and b/docs/reference/growthModels-4.png differ diff --git a/docs/reference/growthModels-5.png b/docs/reference/growthModels-5.png index 3a0bc3ba..a59ea0fd 100644 Binary files a/docs/reference/growthModels-5.png and b/docs/reference/growthModels-5.png differ diff --git a/docs/reference/growthModels-6.png b/docs/reference/growthModels-6.png index bd454d01..db8d3484 100644 Binary files a/docs/reference/growthModels-6.png and b/docs/reference/growthModels-6.png differ diff --git a/docs/reference/growthModels-7.png b/docs/reference/growthModels-7.png index 2bb1c839..09687d39 100644 Binary files a/docs/reference/growthModels-7.png and b/docs/reference/growthModels-7.png differ diff --git a/docs/reference/growthModels-8.png b/docs/reference/growthModels-8.png index fcee5346..2ce03b7d 100644 Binary files a/docs/reference/growthModels-8.png and b/docs/reference/growthModels-8.png differ diff --git a/docs/reference/growthModels-9.png b/docs/reference/growthModels-9.png index 6fd2f370..b3ceebbb 100644 Binary files a/docs/reference/growthModels-9.png and b/docs/reference/growthModels-9.png differ diff --git a/docs/reference/growthModels.html b/docs/reference/growthModels.html index c0418063..200433c3 100644 --- a/docs/reference/growthModels.html +++ b/docs/reference/growthModels.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1
( vb2 <- vbFuns("Francis") )
#> Warning: 'vbFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,L1,L2=NULL,L3=NULL,t1,t3=NULL) {
-#> if (length(L1)==3) { L2 <- L1[[2]]; L3 <- L1[[3]]; L1 <- L1[[1]] }
-#> if (length(t1)==2) { t3 <- t1[[2]]; t1 <- t1[[1]] }
-#> r <- (L3-L2)/(L2-L1)
-#> L1+(L3-L1)*((1-r^(2*((t-t1)/(t3-t1))))/(1-r^2))
-#> }
-#> <bytecode: 0x000001b13b8875f0>
-#> <environment: 0x000001b13be34878>
+#> function (t, L1, L2 = NULL, L3 = NULL, t1, t3 = NULL)
+#> {
+#> if (length(L1) == 3) {
+#> L2 <- L1[[2]]
+#> L3 <- L1[[3]]
+#> L1 <- L1[[1]]
+#> }
+#> if (length(t1) == 2) {
+#> t3 <- t1[[2]]
+#> t1 <- t1[[1]]
+#> }
+#> r <- (L3 - L2)/(L2 - L1)
+#> L1 + (L3 - L1) * ((1 - r^(2 * ((t - t1)/(t3 - t1))))/(1 -
+#> r^2))
+#> }
+#> <bytecode: 0x000001d723c47ab0>
+#> <environment: 0x000001d725261d88>
plot(vb2(ages,L1=10,L2=19,L3=20,t1=2,t3=18)~ages,type="b",pch=19)
( vb2c <- vbFuns("Francis",simple=TRUE) ) # compare to vb2
#> Warning: 'vbFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,L1,L2,L3,t1,t3) {
-#> r <- (L3-L2)/(L2-L1)
-#> L1+(L3-L1)*((1-r^(2*((t-t1)/(t3-t1))))/(1-r^2))
-#> }
-#> <bytecode: 0x000001b13b8a69c8>
-#> <environment: 0x000001b13c5a2618>
+#> function (t, L1, L2, L3, t1, t3)
+#> {
+#> r <- (L3 - L2)/(L2 - L1)
+#> L1 + (L3 - L1) * ((1 - r^(2 * ((t - t1)/(t3 - t1))))/(1 -
+#> r^2))
+#> }
+#> <bytecode: 0x000001d723c458f0>
+#> <environment: 0x000001d724b6f538>
## Simple Examples -- Gompertz
( gomp1 <- GompertzFuns() )
#> Warning: 'GompertzFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,gi=NULL,ti=NULL) {
-#> if (length(Linf)==3) { gi <- Linf[[2]]
-#> ti <- Linf[[3]]
-#> Linf <- Linf[[1]] }
-#> Linf*exp(-exp(-gi*(t-ti)))
-#> }
-#> <bytecode: 0x000001b13c8673f0>
-#> <environment: 0x000001b13c832670>
+#> function (t, Linf, gi = NULL, ti = NULL)
+#> {
+#> if (length(Linf) == 3) {
+#> gi <- Linf[[2]]
+#> ti <- Linf[[3]]
+#> Linf <- Linf[[1]]
+#> }
+#> Linf * exp(-exp(-gi * (t - ti)))
+#> }
+#> <bytecode: 0x000001d728867ae8>
+#> <environment: 0x000001d728859880>
plot(gomp1(ages,Linf=800,gi=0.5,ti=5)~ages,type="b",pch=19)
( gomp2 <- GompertzFuns("Ricker2") )
#> Warning: 'GompertzFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,L0,b=NULL,gi=NULL) {
-#> if (length(L0)==3) { b <- L0[[2]]
-#> gi <- L0[[3]]
-#> L0 <- L0[[1]] }
-#> L0*exp(b*(1-exp(-gi*t)))
-#> }
-#> <bytecode: 0x000001b13c87e4f0>
-#> <environment: 0x000001b13c786ed8>
+#> function (t, L0, b = NULL, gi = NULL)
+#> {
+#> if (length(L0) == 3) {
+#> b <- L0[[2]]
+#> gi <- L0[[3]]
+#> L0 <- L0[[1]]
+#> }
+#> L0 * exp(b * (1 - exp(-gi * t)))
+#> }
+#> <bytecode: 0x000001d728868e60>
+#> <environment: 0x000001d72863f0e8>
plot(gomp2(ages,L0=2,b=6,gi=0.5)~ages,type="b",pch=19)
( gomp2c <- GompertzFuns("Ricker2",simple=TRUE) ) # compare to gomp2
#> Warning: 'GompertzFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,L0,b,gi) {
-#> L0*exp(b*(1-exp(-gi*t)))
-#> }
-#> <bytecode: 0x000001b13c883d20>
-#> <environment: 0x000001b13c5d1238>
+#> function (t, L0, b, gi)
+#> {
+#> L0 * exp(b * (1 - exp(-gi * t)))
+#> }
+#> <bytecode: 0x000001d72886bd50>
+#> <environment: 0x000001d7282b6ab0>
( gompT <- GompertzFuns("Troynikov1"))
#> Warning: 'GompertzFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(Lm,dt,Linf,gi=NULL) {
-#> if (length(Linf)==2) { gi <- Linf[2]
-#> Linf <- Linf[1] }
-#> Linf*((Lm/Linf)^exp(-gi*dt))-Lm
-#> }
-#> <bytecode: 0x000001b13c89b1a0>
-#> <environment: 0x000001b138c26060>
+#> function (Lm, dt, Linf, gi = NULL)
+#> {
+#> if (length(Linf) == 2) {
+#> gi <- Linf[2]
+#> Linf <- Linf[1]
+#> }
+#> Linf * ((Lm/Linf)^exp(-gi * dt)) - Lm
+#> }
+#> <bytecode: 0x000001d728866cd8>
+#> <environment: 0x000001d728217270>
## Simple Examples -- Richards
( rich1 <- RichardsFuns(1) )
#> Warning: 'RichardsFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,k=NULL,ti=NULL,b1=NULL) { #eqn 5 from Tjorve & Tjorve (2010)
-#> if (length(Linf)==4) { k <- Linf[[2]]
-#> ti <- Linf[[3]]
-#> b1 <- Linf[[4]]
-#> Linf <- Linf[[1]] }
-#> Linf/((1+b1*exp(-k*(t-ti)))^(1/b1))
-#> }
-#> <bytecode: 0x000001b138c5f6c8>
-#> <environment: 0x000001b138e12ac0>
+#> function (t, Linf, k = NULL, ti = NULL, b1 = NULL)
+#> {
+#> if (length(Linf) == 4) {
+#> k <- Linf[[2]]
+#> ti <- Linf[[3]]
+#> b1 <- Linf[[4]]
+#> Linf <- Linf[[1]]
+#> }
+#> Linf/((1 + b1 * exp(-k * (t - ti)))^(1/b1))
+#> }
+#> <bytecode: 0x000001d72812c6d8>
+#> <environment: 0x000001d728125f20>
plot(rich1(ages,Linf=800,k=0.5,ti=3,b1=0.15)~ages,type="b",pch=19)
( rich2 <- RichardsFuns(2) )
#> Warning: 'RichardsFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,k=NULL,t0=NULL,b2=NULL) { #eqn 3(alt) from Tjorve & Tjorve (2010)
-#> if (length(Linf)==4) { k <- Linf[[2]]
-#> t0 <- Linf[[3]]
-#> b2 <- Linf[[4]]
-#> Linf <- Linf[[1]] }
-#> Linf/((1+exp(-k*(t-t0)))^(-b2))
-#> }
-#> <bytecode: 0x000001b138c67430>
-#> <environment: 0x000001b13928c618>
+#> function (t, Linf, k = NULL, t0 = NULL, b2 = NULL)
+#> {
+#> if (length(Linf) == 4) {
+#> k <- Linf[[2]]
+#> t0 <- Linf[[3]]
+#> b2 <- Linf[[4]]
+#> Linf <- Linf[[1]]
+#> }
+#> Linf/((1 + exp(-k * (t - t0)))^(-b2))
+#> }
+#> <bytecode: 0x000001d72812a2e8>
+#> <environment: 0x000001d727f62680>
plot(rich2(ages,Linf=800,k=0.5,t0=-1,b2=6)~ages,type="b",pch=19)
( rich3 <- RichardsFuns(3) )
#> Warning: 'RichardsFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,k=NULL,L0=NULL,b3=NULL) { #eqn 7 from Tjorve & Tjorve (2010)
-#> if (length(Linf)==4) { k <- Linf[[2]]
-#> L0 <- Linf[[3]]
-#> b3 <- Linf[[4]]
-#> Linf <- Linf[[1]] }
-#> Linf*(1+(((L0/Linf)^(1-b3))-1)*exp(-k*t))^(1/(1-b3))
-#> }
-#> <bytecode: 0x000001b138c83248>
-#> <environment: 0x000001b139383d98>
+#> function (t, Linf, k = NULL, L0 = NULL, b3 = NULL)
+#> {
+#> if (length(Linf) == 4) {
+#> k <- Linf[[2]]
+#> L0 <- Linf[[3]]
+#> b3 <- Linf[[4]]
+#> Linf <- Linf[[1]]
+#> }
+#> Linf * (1 + (((L0/Linf)^(1 - b3)) - 1) * exp(-k * t))^(1/(1 -
+#> b3))
+#> }
+#> <bytecode: 0x000001d72812bc10>
+#> <environment: 0x000001d7274b1d60>
plot(rich3(ages,Linf=800,k=0.5,L0=50,b3=1.5)~ages,type="b",pch=19)
( rich4 <- RichardsFuns(4) )
#> Warning: 'RichardsFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,k=NULL,ti=NULL,b2=NULL) { #eqn 4 from Tjorve & Tjorve (2010)
-#> if (length(Linf)==4) { k <- Linf[[2]]
-#> ti <- Linf[[3]]
-#> b2 <- Linf[[4]]
-#> Linf <- Linf[[1]] }
-#> Linf*(1-(1/b2)*exp(-k*(t-ti)))^b2
-#> }
-#> <bytecode: 0x000001b138c94858>
-#> <environment: 0x000001b1395a1840>
+#> function (t, Linf, k = NULL, ti = NULL, b2 = NULL)
+#> {
+#> if (length(Linf) == 4) {
+#> k <- Linf[[2]]
+#> ti <- Linf[[3]]
+#> b2 <- Linf[[4]]
+#> Linf <- Linf[[1]]
+#> }
+#> Linf * (1 - (1/b2) * exp(-k * (t - ti)))^b2
+#> }
+#> <bytecode: 0x000001d72811e080>
+#> <environment: 0x000001d726fba358>
plot(rich4(ages,Linf=800,k=0.5,ti=3,b2=6)~ages,type="b",pch=19)
( rich5 <- RichardsFuns(5) )
#> Warning: 'RichardsFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,k=NULL,ti=NULL,b3=NULL) { #eqn 6 from Tjorve & Tjorve (2010)
-#> if (length(Linf)==4) { k <- Linf[[2]]
-#> ti <- Linf[[3]]
-#> b3 <- Linf[[4]]
-#> Linf <- Linf[[1]] }
-#> Linf*(1+(b3-1)*exp(-k*(t-ti)))^(1/(1-b3))
-#> }
-#> <bytecode: 0x000001b138c8c690>
-#> <environment: 0x000001b1396d34f8>
+#> function (t, Linf, k = NULL, ti = NULL, b3 = NULL)
+#> {
+#> if (length(Linf) == 4) {
+#> k <- Linf[[2]]
+#> ti <- Linf[[3]]
+#> b3 <- Linf[[4]]
+#> Linf <- Linf[[1]]
+#> }
+#> Linf * (1 + (b3 - 1) * exp(-k * (t - ti)))^(1/(1 - b3))
+#> }
+#> <bytecode: 0x000001d72811fa50>
+#> <environment: 0x000001d726e4e970>
plot(rich5(ages,Linf=800,k=0.5,ti=3,b3=0.95)~ages,type="b",pch=19)
lines(rich5(ages,Linf=800,k=0.5,ti=3,b3=1.5)~ages,type="b",pch=19,col="blue")
( rich2c <- RichardsFuns(2,simple=TRUE) ) # compare to rich2
#> Warning: 'RichardsFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,k,t0,b2) {
-#> Linf/((1+exp(-k*(t-t0)))^(-b2))
-#> }
-#> <bytecode: 0x000001b138c81d98>
-#> <environment: 0x000001b13999bd20>
+#> function (t, Linf, k, t0, b2)
+#> {
+#> Linf/((1 + exp(-k * (t - t0)))^(-b2))
+#> }
+#> <bytecode: 0x000001d72812b388>
+#> <environment: 0x000001d726c31140>
## Simple Examples -- Logistic
( log1 <- logisticFuns() )
#> Warning: 'logisticFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,gninf=NULL,ti=NULL) {
-#> if (length(Linf)==3) { gninf <- Linf[[2]]
-#> ti <- Linf[[3]]
-#> Linf <- Linf[[1]] }
-#> Linf/(1+exp(-gninf*(t-ti)))
-#> }
-#> <bytecode: 0x000001b139b2dd88>
-#> <environment: 0x000001b139b75600>
+#> function (t, Linf, gninf = NULL, ti = NULL)
+#> {
+#> if (length(Linf) == 3) {
+#> gninf <- Linf[[2]]
+#> ti <- Linf[[3]]
+#> Linf <- Linf[[1]]
+#> }
+#> Linf/(1 + exp(-gninf * (t - ti)))
+#> }
+#> <bytecode: 0x000001d726a35d48>
+#> <environment: 0x000001d726a259c8>
plot(log1(ages,Linf=800,gninf=0.5,ti=5)~ages,type="b",pch=19)
( log2 <- logisticFuns("CJ2") )
#> Warning: 'logisticFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,gninf=NULL,a=NULL) {
-#> if (length(Linf)==3) { gninf <- Linf[[2]]
-#> a <- Linf[[3]]
-#> Linf <- Linf[[1]] }
-#> Linf/(1+a*exp(-gninf*t))
-#> }
-#> <bytecode: 0x000001b139b3adc8>
-#> <environment: 0x000001b139c985c8>
+#> function (t, Linf, gninf = NULL, a = NULL)
+#> {
+#> if (length(Linf) == 3) {
+#> gninf <- Linf[[2]]
+#> a <- Linf[[3]]
+#> Linf <- Linf[[1]]
+#> }
+#> Linf/(1 + a * exp(-gninf * t))
+#> }
+#> <bytecode: 0x000001d726a2d178>
+#> <environment: 0x000001d726897f40>
plot(log2(ages,Linf=800,gninf=0.5,a=10)~ages,type="b",pch=19)
( log2c <- logisticFuns("CJ2",simple=TRUE) ) # compare to log2
#> Warning: 'logisticFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,gninf,a) {
-#> Linf/(1+a*exp(-gninf*t))
-#> }
-#> <bytecode: 0x000001b139b4e5b8>
-#> <environment: 0x000001b139dcb2e8>
+#> function (t, Linf, gninf, a)
+#> {
+#> Linf/(1 + a * exp(-gninf * t))
+#> }
+#> <bytecode: 0x000001d726a2ddf0>
+#> <environment: 0x000001d725836a40>
( log3 <- logisticFuns("Karkach") )
#> Warning: 'logisticFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(t,Linf,L0=NULL,gninf=NULL) {
-#> if (length(Linf)==3) { L0 <- Linf[[2]]
-#> gninf <- Linf[[3]]
-#> Linf <- Linf[[1]] }
-#> L0*Linf/(L0+(Linf-L0)*exp(-gninf*t))
-#> }
-#> <bytecode: 0x000001b139b65cb8>
-#> <environment: 0x000001b139e2c6b0>
+#> function (t, Linf, L0 = NULL, gninf = NULL)
+#> {
+#> if (length(Linf) == 3) {
+#> L0 <- Linf[[2]]
+#> gninf <- Linf[[3]]
+#> Linf <- Linf[[1]]
+#> }
+#> L0 * Linf/(L0 + (Linf - L0) * exp(-gninf * t))
+#> }
+#> <bytecode: 0x000001d726a324c8>
+#> <environment: 0x000001d7257448b0>
plot(log3(ages,L0=10,Linf=800,gninf=0.5)~ages,type="b",pch=19)
( log4 <- logisticFuns("Haddon") )
#> Warning: 'logisticFuns()' is deprecated as of v0.10.0. Please use 'makeGrowthFun()' instead as it will be continuously updated in the future.
-#> function(Lm,dLmax,L50=NULL,L95=NULL) {
-#> if (length(dLmax)==3) { L50 <- dLmax[2]
-#> L95 <- dLmax[3]
-#> dLmax <- dLmax[1] }
-#> dLmax/(1+exp(log(19)*((Lm-L50)/(L95-L50))))
-#> }
-#> <bytecode: 0x000001b139b5c9a8>
-#> <environment: 0x000001b139ff52b0>
+#> function (Lm, dLmax, L50 = NULL, L95 = NULL)
+#> {
+#> if (length(dLmax) == 3) {
+#> L50 <- dLmax[2]
+#> L95 <- dLmax[3]
+#> dLmax <- dLmax[1]
+#> }
+#> dLmax/(1 + exp(log(19) * ((Lm - L50)/(L95 - L50))))
+#> }
+#> <bytecode: 0x000001d726a33ae0>
+#> <environment: 0x000001d724d5a488>
###########################################################
@@ -417,7 +471,7 @@ Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/headtail.html b/docs/reference/headtail.html index dcad0948..f1eb896b 100644 --- a/docs/reference/headtail.html +++ b/docs/reference/headtail.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/hist.formula-1.png b/docs/reference/hist.formula-1.png index 9cb3a62c..98c43fc1 100644 Binary files a/docs/reference/hist.formula-1.png and b/docs/reference/hist.formula-1.png differ diff --git a/docs/reference/hist.formula-2.png b/docs/reference/hist.formula-2.png index 86b02342..e14c0113 100644 Binary files a/docs/reference/hist.formula-2.png and b/docs/reference/hist.formula-2.png differ diff --git a/docs/reference/hist.formula-3.png b/docs/reference/hist.formula-3.png index e4502ccb..9b41fd96 100644 Binary files a/docs/reference/hist.formula-3.png and b/docs/reference/hist.formula-3.png differ diff --git a/docs/reference/hist.formula-4.png b/docs/reference/hist.formula-4.png index e6903316..db6fa790 100644 Binary files a/docs/reference/hist.formula-4.png and b/docs/reference/hist.formula-4.png differ diff --git a/docs/reference/hist.formula-5.png b/docs/reference/hist.formula-5.png index ebadcad8..059deb45 100644 Binary files a/docs/reference/hist.formula-5.png and b/docs/reference/hist.formula-5.png differ diff --git a/docs/reference/hist.formula-6.png b/docs/reference/hist.formula-6.png index 17784e39..bc21a05f 100644 Binary files a/docs/reference/hist.formula-6.png and b/docs/reference/hist.formula-6.png differ diff --git a/docs/reference/hist.formula.html b/docs/reference/hist.formula.html index b293b30f..235ac765 100644 --- a/docs/reference/hist.formula.html +++ b/docs/reference/hist.formula.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/hyperCI.html b/docs/reference/hyperCI.html index 4613d2f7..82024293 100644 --- a/docs/reference/hyperCI.html +++ b/docs/reference/hyperCI.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/index.html b/docs/reference/index.html index 05479b9d..a4bffae8 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Summarize and visualize bias and precision among multiple estimates of age for individual fish.
- -agePrecision() summary(<agePrec>)
plotAB()
@@ -74,8 +75,7 @@ Process age-length keys including assigning ages to indvidual fish and visualizing a key.
alkPlot()
alkAgeDist()
alkMeanVar()
@@ -109,8 +112,7 @@ Efficiently calculate and summarize proportional size distribution (PSD) data.
psdVal()
psdPlot()
psdCalc()
psdCI()
psdAdd()
tictactoe()
@@ -162,8 +170,7 @@ Efficiently calculate and summarize relative weight and visualize weight-length data among groups with different slopes.
wrAdd()
lwCompPreds()
@@ -197,8 +207,7 @@ Estimate abundance with capture-recapture data, including handling and summarizing data in a capture history format.
mrOpen() summary(<mrOpen>) confint(<mrOpen>)
capHistConvert()
capHistSum() is.CapHist() plot(<CapHist>)
@@ -232,8 +244,7 @@ Estimate abundance with depletion and removal data.
removal() coef(<removal>) confint(<removal>) summary(<removal>)
@@ -255,8 +267,7 @@ Fit various growth models (von Bertalanffy, Gompertz, logistic, Richards, Schnute) to individual fish.
findGrowthStarts()
@@ -284,8 +297,7 @@ Estimate mortality rates from catch curve data and empirical models.
chapmanRobson() summary(<chapmanRobson>) coef(<chapmanRobson>) confint(<chapmanRobson>) plot(<chapmanRobson>)
Mmethods() metaM()
@@ -313,8 +327,7 @@ Fit various (Beverton-Holt, Ricker, Shepherd) stock-recruitment functions.
srStarts()
@@ -336,8 +350,7 @@ Utilities that are likely useful only to fisheries scientists.
expandLenFreq()
lencat()
@@ -371,8 +387,7 @@ Utilities of a statistical nature that are likely to be useful to a fisheries scientist.
poiCI()
confint(<boot>) htest(<boot>) predict(<boot>) hist(<boot>)
dunnTest() print(<dunnTest>)
lrt() extraSS() print(<extraTest>)
hist(<formula>)
histFromSum()
confint(<nlsBoot>) predict(<nlsBoot>) htest()
ksTest()
logbtcf()
nlsTracePlot()
rSquared()
se()
Summarize()
sumTable()
@@ -490,8 +522,7 @@ Miscellaneous utilities.
capFirst()
col2rgbt()
fact2num()
fishR()
headtail()
kCounts() kPvalue() purl2() reproInfo()
lagratio()
perc()
peek()
repeatedRows2Keep()
validn()
@@ -579,8 +622,7 @@ Data files.
BrookTroutTH
ChinookArg
CodNorwegian
CutthroatAL
Ecoli
GrowthData1
GrowthData2
GrowthData3
Mirex
PikeNY
PikeNYPartial1
PSDlit
PSDWRtest
+
+ SMBassLS
SMBassWB
SpotVA1
WhitefishLC
WR79
WSlit
@@ -704,8 +771,7 @@ Defunct functions.
Deprecated functions.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/ksTest.html b/docs/reference/ksTest.html index 3785dd70..ce938d88 100644 --- a/docs/reference/ksTest.html +++ b/docs/reference/ksTest.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/lagratio.html b/docs/reference/lagratio.html index 679d5c22..3d6f6ad4 100644 --- a/docs/reference/lagratio.html +++ b/docs/reference/lagratio.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/lencat.html b/docs/reference/lencat.html index 3dd5eb25..1be06854 100644 --- a/docs/reference/lencat.html +++ b/docs/reference/lencat.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/logbtcf.html b/docs/reference/logbtcf.html index 666f00b3..dd2eea20 100644 --- a/docs/reference/logbtcf.html +++ b/docs/reference/logbtcf.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/lwCompPreds-1.png b/docs/reference/lwCompPreds-1.png index b5581146..73c7ebde 100644 Binary files a/docs/reference/lwCompPreds-1.png and b/docs/reference/lwCompPreds-1.png differ diff --git a/docs/reference/lwCompPreds-2.png b/docs/reference/lwCompPreds-2.png index fa0c298b..51f51835 100644 Binary files a/docs/reference/lwCompPreds-2.png and b/docs/reference/lwCompPreds-2.png differ diff --git a/docs/reference/lwCompPreds-3.png b/docs/reference/lwCompPreds-3.png index 0001c8a2..f6957121 100644 Binary files a/docs/reference/lwCompPreds-3.png and b/docs/reference/lwCompPreds-3.png differ diff --git a/docs/reference/lwCompPreds-4.png b/docs/reference/lwCompPreds-4.png index ee8ca56a..1f1c12e6 100644 Binary files a/docs/reference/lwCompPreds-4.png and b/docs/reference/lwCompPreds-4.png differ diff --git a/docs/reference/lwCompPreds-5.png b/docs/reference/lwCompPreds-5.png index 8015018d..b5a6ef36 100644 Binary files a/docs/reference/lwCompPreds-5.png and b/docs/reference/lwCompPreds-5.png differ diff --git a/docs/reference/lwCompPreds-6.png b/docs/reference/lwCompPreds-6.png index b5581146..73c7ebde 100644 Binary files a/docs/reference/lwCompPreds-6.png and b/docs/reference/lwCompPreds-6.png differ diff --git a/docs/reference/lwCompPreds.html b/docs/reference/lwCompPreds.html index 277ad095..6c4b10a4 100644 --- a/docs/reference/lwCompPreds.html +++ b/docs/reference/lwCompPreds.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/metaM.html b/docs/reference/metaM.html index ec2c29af..57113c01 100644 --- a/docs/reference/metaM.html +++ b/docs/reference/metaM.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1method="HoenigLM": The “modified Hoenig equation derived with a linear model” as described in Then et al. (2015) on the second line of Table 3. Requires only tmax.
method="HewittHoenig": The “Hewitt and Hoenig (2005) equation” from their equation 8. Requires only tmax.
method="tmax1": The “one-parameter tmax equation” from the first line of Table 3 in Then et al. (2015). Requires only tmax.
method="HamelCope": The equation 7 from Hamel and Cope (2022). Requires only tmax.
method="K1": The “one-parameter K equation” from the fourth line of Table 3 in Then et al. (2015). Requires only K.
method="K2": The “two-parameter K equation” from the fifth line of Table 3 in Then et al. (2015). Requires only K.
method="JensenK1": The “Jensen (1996) one-parameter K equation”. Requires only K.
Kenchington (2014) provided life history parameters for several stocks and used many models to estimate M. I checked the calculations for the PaulyL, PaulyW, HoenigO, HoenigOF, HoenigO2, HoenigO2F, "JensenK1", "Gislason", "AlversonCarney", "Charnov", "ZhangMegrey", "RikhterEfanov1", and "RikhterEfanov2" methods for three stocks. All results perfectly matched Kenchington's results for Chesapeake Bay Anchovy and Rio Formosa Seahorse. For the Norwegian Fjord Lanternfish, all results perfectly matched Kenchington's results except for HoenigOF and HoenigO2F.
Results for the Rio Formosa Seahorse data were also tested against results from M.empirical from fishmethods for the PaulyL, PaulyW, HoenigO, HoenigOF, "Gislason", and "AlversonCarney" methods (the only methods in common between the two packages). All results matched perfectly.
Kenchington (2014) provided life history parameters for several stocks and used many models to estimate M. I checked the calculations for the "PaulyL", "PaulyW", "HoenigO", "HoenigOF", "HoenigO2", "HoenigO2F", "JensenK1", "Gislason", "AlversonCarney", "Charnov", "ZhangMegrey", "RikhterEfanov1", and "RikhterEfanov2" methods for three stocks. All results perfectly matched Kenchington's results for Chesapeake Bay Anchovy and Rio Formosa Seahorse. For the Norwegian Fjord Lanternfish, all results perfectly matched Kenchington's results except for "HoenigOF" and "HoenigO2F".
Results for the Rio Formosa Seahorse data were also tested against results from M.empirical from fishmethods for the "PaulyL", "PaulyW", "HoenigO", "HoenigOF", "Gislason", and "AlversonCarney" methods (the only methods in common between the two packages). All results matched perfectly.
See M.empirical in fishmethods for similar functionality.
See M.empirical in fishmethods for similar functionality and the "Natural Mortality Tool" Shiny app on-line.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/mrOpen.html b/docs/reference/mrOpen.html index 01ae6ac9..73babc2f 100644 --- a/docs/reference/mrOpen.html +++ b/docs/reference/mrOpen.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/nlsBoot.html b/docs/reference/nlsBoot.html index 179fc887..5bca4eea 100644 --- a/docs/reference/nlsBoot.html +++ b/docs/reference/nlsBoot.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/nlsTracePlot-1.png b/docs/reference/nlsTracePlot-1.png index 35c48d3a..b119ea2e 100644 Binary files a/docs/reference/nlsTracePlot-1.png and b/docs/reference/nlsTracePlot-1.png differ diff --git a/docs/reference/nlsTracePlot-2.png b/docs/reference/nlsTracePlot-2.png index 7a224e2d..d210087d 100644 Binary files a/docs/reference/nlsTracePlot-2.png and b/docs/reference/nlsTracePlot-2.png differ diff --git a/docs/reference/nlsTracePlot.html b/docs/reference/nlsTracePlot.html index 09a1807b..7b5deaa3 100644 --- a/docs/reference/nlsTracePlot.html +++ b/docs/reference/nlsTracePlot.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/perc.html b/docs/reference/perc.html index 692077ba..78626473 100644 --- a/docs/reference/perc.html +++ b/docs/reference/perc.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/plotAB-1.png b/docs/reference/plotAB-1.png index 33defbe5..9864537b 100644 Binary files a/docs/reference/plotAB-1.png and b/docs/reference/plotAB-1.png differ diff --git a/docs/reference/plotAB-2.png b/docs/reference/plotAB-2.png index 1554ad9c..0972827f 100644 Binary files a/docs/reference/plotAB-2.png and b/docs/reference/plotAB-2.png differ diff --git a/docs/reference/plotAB-3.png b/docs/reference/plotAB-3.png index 8d834a24..a6662934 100644 Binary files a/docs/reference/plotAB-3.png and b/docs/reference/plotAB-3.png differ diff --git a/docs/reference/plotAB-4.png b/docs/reference/plotAB-4.png index 939342b7..f1cf73b7 100644 Binary files a/docs/reference/plotAB-4.png and b/docs/reference/plotAB-4.png differ diff --git a/docs/reference/plotAB.html b/docs/reference/plotAB.html index e438e7c5..4ec7fcfd 100644 --- a/docs/reference/plotAB.html +++ b/docs/reference/plotAB.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1A numeric that controls the separate ‘sfrac’ arguments (e.g., sfrac.CI and sfrac.range). See sfrac in plotCI of plotrix.
A numeric that controls the separate ‘sfrac’ arguments (e.g., sfrac.CI and sfrac.range). See sfrac in plotCI of plotrix.
A numeric for the size of the ends of the confidence interval bars. See sfrac in plotCI of plotrix.
A numeric for the size of the ends of the confidence interval bars. See sfrac in plotCI of plotrix.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/poiCI.html b/docs/reference/poiCI.html index 72f1e9a1..df716848 100644 --- a/docs/reference/poiCI.html +++ b/docs/reference/poiCI.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/psdAdd.html b/docs/reference/psdAdd.html index ad85d336..23790ff9 100644 --- a/docs/reference/psdAdd.html +++ b/docs/reference/psdAdd.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1A named list for providing alternative species names (the values in the list) that correspond to specific names in PSDlit (the names in the list). See details and examples.
A named list that provides specific choices for group for species for which more than one set of Gabelhouse lengths exists in PSDlit.
This computes a vector that contains the Gabelhouse lengths specific to each species for all individuals in an entire data frame. The vector can be appended to an existing data.frame to create a variable that contains the Gabelhouse lengths for each individual. The Gabelhouse length value will be NA for each individual for which Gabelhouse length definitions do not exist in PSDlit. Species names in the data.frame must be the same as those used in PSDlit (i.e., same spelling and capitalization; use psdVal() to see the list of species).
Some species have Gabelhouse lengths for sub-groups (e.g., “lentic” vs “lotic”). For these species, choose which sub-group to use with group.
The thesaurus argument may be used to relate alternate species names to the species names used in PSDlit. For example, you (or your data) may use “Bluegill Sunfish”, but “Bluegill” is used in PSDlit. The alternate species name can be used here if it is defined in a named vector (or list) given to thesarus=. The alternate species name is the value and the species name in PSDlit is the name in this vector/list - e.g., c("Bluegill"="Bluegill Sunfish"). See the examples for a demonstration.
Some species have length categories separated by sub-group. For example, length categories exist for both lentic and lotic populations of Brown Trout. The length values for a sub-group may be obtained by either including the species name in species and the sub-group name in group or by using the combined species and sub-group name, with the sub-group name in parentheses, in species. Both methods are demonstrated in the examples. Note that an error is returned if a species has sub-groups but neither method is used to define the sub-group.#'
Individuals shorter than “stock” length will be listed as substock if use.names=TRUE or 0 if use.names=FALSE.
Additional lengths to be used for a species may be included by giving a named list with vectors of additional lengths in addLens. Note, however, that as.fact will be reset to FALSE if addLens are specified, as there is no way to order the names (i.e., factor levels) for all species when additional lengths are used.
See examples and this article for a demonstration.
@@ -155,151 +162,260 @@#===== Create random data for three species
-set.seed(345234534)
-dbg <- data.frame(species=factor(rep(c("Bluegill"),30)),
- tl=round(rnorm(30,130,50),0))
-dlb <- data.frame(species=factor(rep(c("Largemouth Bass"),30)),
- tl=round(rnorm(30,350,60),0))
-dbt <- data.frame(species=factor(rep(c("Bluefin Tuna"),30)),
- tl=round(rnorm(30,1900,300),0))
-df <- rbind(dbg,dlb,dbt)
+ #===== Simple examples -- 2 species, no groups, names as in PSDlit
+#----- Isolate simple data from PSDWRtest
+tmp <- subset(PSDWRtest,
+ species %in% c("Yellow Perch","Largemouth Bass"),
+ select=c("species","len"))
+peek(tmp,n=6)
+#> species len
+#> 412 Largemouth Bass 183
+#> 463 Largemouth Bass 319
+#> 860 Yellow Perch 180
+#> 912 Yellow Perch 170
+#> 964 Yellow Perch 266
+#> 1016 Yellow Perch 322
-#===== Simple examples
#----- Add variable using category names -- non-formula notation
-df$PSD <- psdAdd(df$tl,df$species)
-#> Species in the data with no Gabelhouse (PSD) lengths in `PSDlit`:
-#> "Bluefin Tuna".
-peek(df,n=6)
-#> species tl PSD
-#> 1 Bluegill 42 substock
-#> 18 Bluegill 120 stock
-#> 36 Largemouth Bass 491 preferred
-#> 54 Largemouth Bass 293 stock
-#> 72 Bluefin Tuna 2476 <NA>
-#> 90 Bluefin Tuna 1551 <NA>
+tmp$PSD <- psdAdd(tmp$len,tmp$species)
+peek(tmp,n=6)
+#> species len PSD
+#> 412 Largemouth Bass 183 substock
+#> 463 Largemouth Bass 319 quality
+#> 860 Yellow Perch 180 stock
+#> 912 Yellow Perch 170 stock
+#> 964 Yellow Perch 266 preferred
+#> 1016 Yellow Perch 322 memorable
#----- Add variable using category names -- formula notation
-df$PSD1 <- psdAdd(tl~species,data=df)
-#> Species in the data with no Gabelhouse (PSD) lengths in `PSDlit`:
-#> "Bluefin Tuna".
-peek(df,n=6)
-#> species tl PSD PSD1
-#> 1 Bluegill 42 substock substock
-#> 18 Bluegill 120 stock stock
-#> 36 Largemouth Bass 491 preferred preferred
-#> 54 Largemouth Bass 293 stock stock
-#> 72 Bluefin Tuna 2476 <NA> <NA>
-#> 90 Bluefin Tuna 1551 <NA> <NA>
+tmp$PSD1 <- psdAdd(len~species,data=tmp)
+peek(tmp,n=6)
+#> species len PSD PSD1
+#> 412 Largemouth Bass 183 substock substock
+#> 463 Largemouth Bass 319 quality quality
+#> 860 Yellow Perch 180 stock stock
+#> 912 Yellow Perch 170 stock stock
+#> 964 Yellow Perch 266 preferred preferred
+#> 1016 Yellow Perch 322 memorable memorable
#----- Add variable using length values as names
-# Also turned off messaging of fish not in PSDlit
-df$PSD2 <- psdAdd(tl~species,data=df,use.names=FALSE,verbose=FALSE)
-peek(df,n=6)
-#> species tl PSD PSD1 PSD2
-#> 1 Bluegill 42 substock substock 0
-#> 18 Bluegill 120 stock stock 80
-#> 36 Largemouth Bass 491 preferred preferred 380
-#> 54 Largemouth Bass 293 stock stock 200
-#> 72 Bluefin Tuna 2476 <NA> <NA> NA
-#> 90 Bluefin Tuna 1551 <NA> <NA> NA
+tmp$PSD2 <- psdAdd(len~species,data=tmp,use.names=FALSE)
+peek(tmp,n=6)
+#> species len PSD PSD1 PSD2
+#> 412 Largemouth Bass 183 substock substock 0
+#> 463 Largemouth Bass 319 quality quality 300
+#> 860 Yellow Perch 180 stock stock 130
+#> 912 Yellow Perch 170 stock stock 130
+#> 964 Yellow Perch 266 preferred preferred 250
+#> 1016 Yellow Perch 322 memorable memorable 300
#----- Same as above but using dplyr
if (require(dplyr)) {
- df <- df %>%
- mutate(PSD1A=psdAdd(tl,species,verbose=FALSE),
- PSD2A=psdAdd(tl,species,use.names=FALSE,verbose=FALSE))
- peek(df,n=6)
+ tmp <- tmp %>%
+ mutate(PSD1A=psdAdd(len,species),
+ PSD2A=psdAdd(len,species,use.names=FALSE))
+ peek(tmp,n=6)
}
-#> species tl PSD PSD1 PSD2 PSD1A PSD2A
-#> 1 Bluegill 42 substock substock 0 substock 0
-#> 18 Bluegill 120 stock stock 80 stock 80
-#> 36 Largemouth Bass 491 preferred preferred 380 preferred 380
-#> 54 Largemouth Bass 293 stock stock 200 stock 200
-#> 72 Bluefin Tuna 2476 <NA> <NA> NA <NA> NA
-#> 90 Bluefin Tuna 1551 <NA> <NA> NA <NA> NA
+#> species len PSD PSD1 PSD2 PSD1A PSD2A
+#> 412 Largemouth Bass 183 substock substock 0 substock 0
+#> 463 Largemouth Bass 319 quality quality 300 quality 300
+#> 860 Yellow Perch 180 stock stock 130 stock 130
+#> 912 Yellow Perch 170 stock stock 130 stock 130
+#> 964 Yellow Perch 266 preferred preferred 250 preferred 250
+#> 1016 Yellow Perch 322 memorable memorable 300 memorable 300
+
+#===== Add lengths besides Gabelhouse lengths (start over with same simple data)
+tmp <- subset(PSDWRtest,
+ species %in% c("Yellow Perch","Largemouth Bass"),
+ select=c("species","len"))
+
+#----- Add a "minimum length" for one species
+tmp$PSD3 <- psdAdd(len~species,data=tmp,
+ addLens=list("Yellow Perch"=c("minLen"=225)))
+tmp$PSD3A <- psdAdd(len~species,data=tmp,
+ addLens=list("Yellow Perch"=225))
+tmp$PSD3B <- psdAdd(len~species,data=tmp,
+ addLens=list("Yellow Perch"=c("minLen"=225)),use.names=FALSE)
+head(tmp,n=6)
+#> species len PSD3 PSD3A PSD3B
+#> 412 Largemouth Bass 183 substock substock 0
+#> 413 Largemouth Bass 208 stock stock 200
+#> 414 Largemouth Bass 200 stock stock 200
+#> 415 Largemouth Bass 200 stock stock 200
+#> 416 Largemouth Bass 191 substock substock 0
+#> 417 Largemouth Bass 207 stock stock 200
+
+#----- Add add'l lengths and names for multiple species
+tmp$psd4 <- psdAdd(len~species,data=tmp,
+ addLens=list("Yellow Perch"=175,
+ "Largemouth Bass"=c(254,306)))
+peek(tmp,n=20)
+#> species len PSD3 PSD3A PSD3B psd4
+#> 412 Largemouth Bass 183 substock substock 0 substock
+#> 425 Largemouth Bass 202 stock stock 200 stock
+#> 438 Largemouth Bass 213 stock stock 200 stock
+#> 452 Largemouth Bass 296 stock stock 200 254
+#> 466 Largemouth Bass 295 stock stock 200 254
+#> 479 Largemouth Bass 316 quality quality 300 306
+#> 493 Largemouth Bass 335 quality quality 300 306
+#> 852 Yellow Perch 146 stock stock 130 stock
+#> 865 Yellow Perch 170 stock stock 130 stock
+#> 879 Yellow Perch 182 stock stock 130 175
+#> 893 Yellow Perch 172 stock stock 130 stock
+#> 907 Yellow Perch 148 stock stock 130 stock
+#> 920 Yellow Perch 135 stock stock 130 stock
+#> 934 Yellow Perch 141 stock stock 130 stock
+#> 948 Yellow Perch 203 quality quality 200 quality
+#> 961 Yellow Perch 244 minLen 225 225 quality
+#> 975 Yellow Perch 249 minLen 225 225 quality
+#> 989 Yellow Perch 228 minLen 225 225 quality
+#> 1002 Yellow Perch 306 memorable memorable 300 memorable
+#> 1016 Yellow Perch 322 memorable memorable 300 memorable
+
+#===== Handle additional species in PSDlit but named differently
+#----- Isolate different species data from PSDWRtest
+tmp <- subset(PSDWRtest,
+ species %in% c("Bluegill Sunfish","Lean Lake Trout"),
+ select=c("species","len"))
+
+#----- No "Bluegill Sunfish" in PSDlit, use thesaurus to note this is "Bluegill"
+# Note: "Lean Lake Trout" not processed as not in PSDlit
+tmp$psd5 <- psdAdd(len~species,data=tmp,
+ thesaurus=c("Bluegill"="Bluegill Sunfish"))
+#> Species in the data with no Gabelhouse (PSD) lengths in `PSDlit`: "Lean
+#> Lake Trout".
+peek(tmp,n=6)
+#> species len psd5
+#> 1 Bluegill Sunfish 107 stock
+#> 44 Bluegill Sunfish 154 quality
+#> 88 Bluegill Sunfish 172 quality
+#> 513 Lean Lake Trout 500 <NA>
+#> 557 Lean Lake Trout 478 <NA>
+#> 601 Lean Lake Trout 829 <NA>
+
+#----- Process multiple species in PSDlit with different names
+# Note: Can still use addLens=, but with original name
+thes <- c("Bluegill"="Bluegill Sunfish","Lake Trout"="Lean Lake Trout")
+tmp$psd6 <- psdAdd(len~species,data=tmp,thesaurus=thes)
+tmp$psd7 <- psdAdd(len~species,data=tmp,thesaurus=thes,
+ addLens=list("Bluegill Sunfish"=c("minLen"=175)))
+peek(tmp,n=20)
+#> species len psd5 psd6 psd7
+#> 1 Bluegill Sunfish 107 stock stock stock
+#> 12 Bluegill Sunfish 108 stock stock stock
+#> 23 Bluegill Sunfish 85 stock stock stock
+#> 35 Bluegill Sunfish 136 stock stock stock
+#> 46 Bluegill Sunfish 167 quality quality quality
+#> 58 Bluegill Sunfish 165 quality quality quality
+#> 69 Bluegill Sunfish 164 quality quality quality
+#> 81 Bluegill Sunfish 144 stock stock stock
+#> 93 Bluegill Sunfish 103 stock stock stock
+#> 104 Bluegill Sunfish 156 quality quality quality
+#> 116 Bluegill Sunfish 215 preferred preferred preferred
+#> 508 Lean Lake Trout 274 <NA> substock substock
+#> 520 Lean Lake Trout 448 <NA> stock stock
+#> 532 Lean Lake Trout 487 <NA> stock stock
+#> 543 Lean Lake Trout 512 <NA> quality quality
+#> 555 Lean Lake Trout 521 <NA> quality quality
+#> 566 Lean Lake Trout 503 <NA> quality quality
+#> 578 Lean Lake Trout 781 <NA> preferred preferred
+#> 589 Lean Lake Trout 770 <NA> preferred preferred
+#> 601 Lean Lake Trout 829 <NA> memorable memorable
+
+#===== Example for a species with sub-groups but only one sub-group in data
+#----- Isolate species data from PSDWRtest ... only Brook Trout has sub-group
+tmp <- subset(PSDWRtest,
+ species %in% c("Yellow Perch","Brook Trout"),
+ select=c("species","len"))
+
+#----- This will err as Brook Trout has sub-groups in PSDlit (as message notes)
+# tmp$psd8 <- psdAdd(len~species,data=tmp)
+
+#----- Can choose "overall" sub-group with group=
+tmp$psd8 <- psdAdd(len~species,data=tmp,
+ group=list("Brook Trout"="overall"))
+peek(tmp,n=10)
+#> species len psd8
+#> 121 Brook Trout 147 substock
+#> 148 Brook Trout 241 stock
+#> 176 Brook Trout 250 stock
+#> 849 Yellow Perch 133 stock
+#> 877 Yellow Perch 101 substock
+#> 905 Yellow Perch 123 substock
+#> 933 Yellow Perch 141 stock
+#> 960 Yellow Perch 277 preferred
+#> 988 Yellow Perch 257 preferred
+#> 1016 Yellow Perch 322 memorable
-#===== Adding lengths besides the Gabelhouse lengths
-#----- Add a "minimum length" for Bluegill
-df$PSD3 <- psdAdd(tl~species,data=df,verbose=FALSE,
- addLens=list("Bluegill"=c("minLen"=175)))
-df$PSD3A <- psdAdd(tl~species,data=df,verbose=FALSE,
- addLens=list("Bluegill"=175))
-df$PSD3B <- psdAdd(tl~species,data=df,verbose=FALSE,
- addLens=list("Bluegill"=c("minLen"=175)),use.names=FALSE)
-head(df,n=6)
-#> species tl PSD PSD1 PSD2 PSD1A PSD2A PSD3 PSD3A PSD3B
-#> 1 Bluegill 42 substock substock 0 substock 0 substock substock 0
-#> 2 Bluegill 73 substock substock 0 substock 0 substock substock 0
-#> 3 Bluegill 152 quality quality 150 quality 150 quality quality 150
-#> 4 Bluegill 184 quality quality 150 quality 150 minLen 175 175
-#> 5 Bluegill 167 quality quality 150 quality 150 quality quality 150
-#> 6 Bluegill 94 stock stock 80 stock 80 stock stock 80
+#----- Or can create species name with sub-group name in parentheses
+# Note: this is more useful in next examples
+tmp$species2 <- ifelse(tmp$species=="Brook Trout","Brook Trout (overall)",
+ tmp$species)
+tmp$psd8A <- psdAdd(len~species2,data=tmp) # note use of species2
+peek(tmp,n=10)
+#> species len psd8 species2 psd8A
+#> 121 Brook Trout 147 substock Brook Trout (overall) substock
+#> 148 Brook Trout 241 stock Brook Trout (overall) stock
+#> 176 Brook Trout 250 stock Brook Trout (overall) stock
+#> 849 Yellow Perch 133 stock Yellow Perch stock
+#> 877 Yellow Perch 101 substock Yellow Perch substock
+#> 905 Yellow Perch 123 substock Yellow Perch substock
+#> 933 Yellow Perch 141 stock Yellow Perch stock
+#> 960 Yellow Perch 277 preferred Yellow Perch preferred
+#> 988 Yellow Perch 257 preferred Yellow Perch preferred
+#> 1016 Yellow Perch 322 memorable Yellow Perch memorable
-#----- Add add'l lengths and names for Bluegill and Largemouth Bass
-df$psd4 <- psdAdd(tl~species,data=df,verbose=FALSE,
- addLens=list("Bluegill"=175,
- "Largemouth Bass"=c(254,356)))
-peek(df,n=20)
-#> species tl PSD PSD1 PSD2 PSD1A PSD2A PSD3
-#> 1 Bluegill 42 substock substock 0 substock 0 substock
-#> 5 Bluegill 167 quality quality 150 quality 150 quality
-#> 9 Bluegill 86 stock stock 80 stock 80 stock
-#> 14 Bluegill 124 stock stock 80 stock 80 stock
-#> 19 Bluegill 155 quality quality 150 quality 150 quality
-#> 24 Bluegill 108 stock stock 80 stock 80 stock
-#> 28 Bluegill 94 stock stock 80 stock 80 stock
-#> 33 Largemouth Bass 433 preferred preferred 380 preferred 380 preferred
-#> 38 Largemouth Bass 293 stock stock 200 stock 200 stock
-#> 43 Largemouth Bass 396 preferred preferred 380 preferred 380 preferred
-#> 47 Largemouth Bass 268 stock stock 200 stock 200 stock
-#> 52 Largemouth Bass 279 stock stock 200 stock 200 stock
-#> 57 Largemouth Bass 345 quality quality 300 quality 300 quality
-#> 62 Bluefin Tuna 2064 <NA> <NA> NA <NA> NA <NA>
-#> 66 Bluefin Tuna 2273 <NA> <NA> NA <NA> NA <NA>
-#> 71 Bluefin Tuna 1785 <NA> <NA> NA <NA> NA <NA>
-#> 76 Bluefin Tuna 1596 <NA> <NA> NA <NA> NA <NA>
-#> 81 Bluefin Tuna 1692 <NA> <NA> NA <NA> NA <NA>
-#> 85 Bluefin Tuna 1997 <NA> <NA> NA <NA> NA <NA>
-#> 90 Bluefin Tuna 1551 <NA> <NA> NA <NA> NA <NA>
-#> PSD3A PSD3B psd4
-#> 1 substock 0 substock
-#> 5 quality 150 quality
-#> 9 stock 80 stock
-#> 14 stock 80 stock
-#> 19 quality 150 quality
-#> 24 stock 80 stock
-#> 28 stock 80 stock
-#> 33 preferred 380 preferred
-#> 38 stock 200 254
-#> 43 preferred 380 preferred
-#> 47 stock 200 254
-#> 52 stock 200 254
-#> 57 quality 300 quality
-#> 62 <NA> NA <NA>
-#> 66 <NA> NA <NA>
-#> 71 <NA> NA <NA>
-#> 76 <NA> NA <NA>
-#> 81 <NA> NA <NA>
-#> 85 <NA> NA <NA>
-#> 90 <NA> NA <NA>
+#===== Example for species with more than one sub-group in data
+#----- Isolate species data from PSDWRtest ... Brown Trout has two sub-groups
+tmp <- subset(PSDWRtest,
+ species %in% c("Yellow Perch","Largemouth Bass","Brown Trout"),
+ select=c("species","len","location"))
+peek(tmp,n=10)
+#> species len location
+#> 201 Brown Trout 128 Trout Lake
+#> 249 Brown Trout 269 Trout Lake
+#> 298 Brown Trout 207 Brushy Creek
+#> 346 Brown Trout 298 Brushy Creek
+#> 427 Largemouth Bass 198 Bass Lake
+#> 476 Largemouth Bass 285 Bass Lake
+#> 870 Yellow Perch 190 Bass Lake
+#> 918 Yellow Perch 197 Bass Lake
+#> 967 Yellow Perch 239 Bass Lake
+#> 1016 Yellow Perch 322 Bass Lake
-#===== Example for a species with sub-groups
-dbt <- data.frame(species=factor(rep(c("Brown Trout"),30)),
- tl=round(rnorm(30,230,50),0))
-dlt <- data.frame(species=factor(rep(c("Lake Trout"),30)),
- tl=round(rnorm(30,550,60),0))
-df2 <- rbind(dbt,dlt)
+#----- Must create a species name variable with sub-groups in parentheses
+# Note: there are likely many ways to do this specific to each use-case
+tmp$species2 <- tmp$species
+tmp$species2[tmp$species=="Brown Trout" &
+ tmp$location=="Trout Lake"] <- "Brown Trout (lotic)"
+tmp$species2[tmp$species=="Brown Trout" &
+ tmp$location=="Brushy Creek"] <- "Brown Trout (lentic)"
+peek(tmp,n=10)
+#> species len location species2
+#> 201 Brown Trout 128 Trout Lake Brown Trout (lotic)
+#> 249 Brown Trout 269 Trout Lake Brown Trout (lotic)
+#> 298 Brown Trout 207 Brushy Creek Brown Trout (lentic)
+#> 346 Brown Trout 298 Brushy Creek Brown Trout (lentic)
+#> 427 Largemouth Bass 198 Bass Lake Largemouth Bass
+#> 476 Largemouth Bass 285 Bass Lake Largemouth Bass
+#> 870 Yellow Perch 190 Bass Lake Yellow Perch
+#> 918 Yellow Perch 197 Bass Lake Yellow Perch
+#> 967 Yellow Perch 239 Bass Lake Yellow Perch
+#> 1016 Yellow Perch 322 Bass Lake Yellow Perch
-df2$psd <- psdAdd(tl~species,data=df2,group=list("Brown Trout"="lentic"))
-peek(df2,n=6)
-#> species tl psd
-#> 1 Brown Trout 194 substock
-#> 12 Brown Trout 215 stock
-#> 24 Brown Trout 241 stock
-#> 36 Lake Trout 629 quality
-#> 48 Lake Trout 536 quality
-#> 60 Lake Trout 571 quality
+tmp$psd9 <- psdAdd(len~species2,data=tmp)
+peek(tmp,n=10)
+#> species len location species2 psd9
+#> 201 Brown Trout 128 Trout Lake Brown Trout (lotic) substock
+#> 249 Brown Trout 269 Trout Lake Brown Trout (lotic) quality
+#> 298 Brown Trout 207 Brushy Creek Brown Trout (lentic) stock
+#> 346 Brown Trout 298 Brushy Creek Brown Trout (lentic) stock
+#> 427 Largemouth Bass 198 Bass Lake Largemouth Bass substock
+#> 476 Largemouth Bass 285 Bass Lake Largemouth Bass stock
+#> 870 Yellow Perch 190 Bass Lake Yellow Perch stock
+#> 918 Yellow Perch 197 Bass Lake Yellow Perch stock
+#> 967 Yellow Perch 239 Bass Lake Yellow Perch quality
+#> 1016 Yellow Perch 322 Bass Lake Yellow Perch memorable
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/psdCalc.html b/docs/reference/psdCalc.html index b2fb1639..b399a22d 100644 --- a/docs/reference/psdCalc.html +++ b/docs/reference/psdCalc.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1#===== Random length data for Yellow Perch (for example) to the nearest mm
-set.seed(633437)
-yepdf <- data.frame(yepmm=round(c(rnorm(100,mean=125,sd=15),
- rnorm(50,mean=200,sd=25),
- rnorm(20,mean=270,sd=40)),0),
- species=rep("Yellow Perch",170))
-
-#===== Simple (typical) uses with just Gabelhouse lengths
+ #===== Simple (typical) uses with just Gabelhouse lengths
+tmp <- subset(PSDWRtest,species=="Yellow Perch",select=c("species","len"))
+
#----- All results
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch")
+psdCalc(~len,data=tmp,species="Yellow Perch")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-Q 40 27 54
-#> PSD-P 14 5 23
-#> PSD-M 5 0 10
-#> PSD S-Q 60 46 73
-#> PSD Q-P 27 15 38
-#> PSD P-M 9 1 17
-#> PSD M-T 5 0 10
+#> PSD-Q 48 36 59
+#> PSD-P 31 21 42
+#> PSD-M 5 0 11
+#> PSD S-Q 52 41 64
+#> PSD Q-P 16 8 25
+#> PSD P-M 26 16 36
+#> PSD M-T 5 0 11
#----- Just the traditional indices
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch",what="traditional")
+psdCalc(~len,data=tmp,species="Yellow Perch",what="traditional")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-Q 40 27 54
-#> PSD-P 14 5 23
-#> PSD-M 5 0 10
+#> PSD-Q 48 36 59
+#> PSD-P 31 21 42
+#> PSD-M 5 0 11
#----- Just the incremental indices
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch",what="incremental")
+psdCalc(~len,data=tmp,species="Yellow Perch",what="incremental")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD S-Q 60 46 73
-#> PSD Q-P 27 15 38
-#> PSD P-M 9 1 17
-#> PSD M-T 5 0 10
+#> PSD S-Q 52 41 64
+#> PSD Q-P 16 8 25
+#> PSD P-M 26 16 36
+#> PSD M-T 5 0 11
#===== Add a custom length of interest (to the Gabelhouse lengths)
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch",addLens=150)
+psdCalc(~len,data=tmp,species="Yellow Perch",addLens=150)
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-150 67 53 81
-#> PSD-Q 40 26 55
-#> PSD-P 14 4 24
+#> PSD-150 84 74 93
+#> PSD-Q 48 35 60
+#> PSD-P 31 20 43
#> PSD-M 5 0 11
-#> PSD S-150 33 19 47
-#> PSD 150-Q 27 14 40
-#> PSD Q-P 27 14 40
-#> PSD P-M 9 1 18
+#> PSD S-150 16 7 26
+#> PSD 150-Q 36 24 48
+#> PSD Q-P 16 7 26
+#> PSD P-M 26 15 37
#> PSD M-T 5 0 11
#----- Additional lengths can be named
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch",addLens=c("minLen"=150))
+psdCalc(~len,data=tmp,species="Yellow Perch",addLens=c("minLen"=150))
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-minLen 67 53 81
-#> PSD-Q 40 26 55
-#> PSD-P 14 4 24
+#> PSD-minLen 84 74 93
+#> PSD-Q 48 35 60
+#> PSD-P 31 20 43
#> PSD-M 5 0 11
-#> PSD S-minLen 33 19 47
-#> PSD minLen-Q 27 14 40
-#> PSD Q-P 27 14 40
-#> PSD P-M 9 1 18
+#> PSD S-minLen 16 7 26
+#> PSD minLen-Q 36 24 48
+#> PSD Q-P 16 7 26
+#> PSD P-M 26 15 37
#> PSD M-T 5 0 11
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
+psdCalc(~len,data=tmp,species="Yellow Perch",
addLens=c("minLen"=150,"maxslot"=275))
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-minLen 67 52 82
-#> PSD-Q 40 25 56
-#> PSD-P 14 3 25
-#> PSD-maxslot 9 0 18
-#> PSD-M 5 0 11
-#> PSD S-minLen 33 18 48
-#> PSD minLen-Q 27 13 41
-#> PSD Q-P 27 13 41
-#> PSD P-maxslot 5 0 11
-#> PSD maxslot-M 5 0 11
-#> PSD M-T 5 0 11
+#> PSD-minLen 84 74 94
+#> PSD-Q 48 34 61
+#> PSD-P 31 19 44
+#> PSD-maxslot 14 5 24
+#> PSD-M 5 0 12
+#> PSD S-minLen 16 6 26
+#> PSD minLen-Q 36 23 49
+#> PSD Q-P 16 6 26
+#> PSD P-maxslot 17 7 27
+#> PSD maxslot-M 9 1 17
+#> PSD M-T 5 0 12
#----- Can return just those results that include the additional lengths
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
+psdCalc(~len,data=tmp,species="Yellow Perch",
addLens=c("minSlot"=150,"maxSlot"=275),justAdds=TRUE)
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-minSlot 67 52 82
-#> PSD-maxSlot 9 0 18
-#> PSD S-minSlot 33 18 48
-#> PSD minSlot-Q 27 13 41
-#> PSD P-maxSlot 5 0 11
-#> PSD maxSlot-M 5 0 11
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
+#> PSD-minSlot 84 74 94
+#> PSD-maxSlot 14 5 24
+#> PSD S-minSlot 16 6 26
+#> PSD minSlot-Q 36 23 49
+#> PSD P-maxSlot 17 7 27
+#> PSD maxSlot-M 9 1 17
+psdCalc(~len,data=tmp,species="Yellow Perch",
addLens=c("minSlot"=150,"maxSlot"=275),justAdds=TRUE,what="traditional")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-minSlot 67 52 82
-#> PSD-maxSlot 9 0 18
+#> PSD-minSlot 84 74 94
+#> PSD-maxSlot 14 5 24
#===== Can show intermediate values (num in category and in stock)
-psdCalc(~yepmm,data=yepdf,species="Yellow Perch",showInterm=TRUE)
+psdCalc(~len,data=tmp,species="Yellow Perch",showInterm=TRUE)
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> num stock Estimate 95% LCI 95% UCI
-#> PSD-Q 44 109 40 27 54
-#> PSD-P 15 109 14 5 23
-#> PSD-M 5 109 5 0 10
-#> PSD S-Q 65 109 60 46 73
-#> PSD Q-P 29 109 27 15 38
-#> PSD P-M 10 109 9 1 17
-#> PSD M-T 5 109 5 0 10
+#> PSD-Q 71 147 48 36 59
+#> PSD-P 46 147 31 21 42
+#> PSD-M 7 147 5 0 11
+#> PSD S-Q 76 147 52 41 64
+#> PSD Q-P 24 147 16 8 25
+#> PSD P-M 38 147 26 16 36
+#> PSD M-T 7 147 5 0 11
+
+#===== Some species require use of group
+tmp <- subset(PSDWRtest,species=="Brown Trout" & location=="Trout Lake",
+ select=c("species","location","len"))
+peek(tmp,n=6)
+#> species location len
+#> 201 Brown Trout Trout Lake 128
+#> 216 Brown Trout Trout Lake 164
+#> 232 Brown Trout Trout Lake 205
+#> 248 Brown Trout Trout Lake 261
+#> 264 Brown Trout Trout Lake 208
+#> 280 Brown Trout Trout Lake 350
-#===== Some species require use of group (e.g., treat these as if Brown Trout)
-psdCalc(~yepmm,data=yepdf,species="Brown Trout",group="lotic")
+# will err because Brown Trout has sub-groups in PSDlit
+# psdCalc(~len,data=tmp,species="Brown Trout")
+psdCalc(~len,data=tmp,species="Brown Trout",group="lotic")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-Q 26 13 39
-#> PSD-P 7 0 14
-#> PSD S-Q 74 61 87
-#> PSD Q-P 19 8 30
-#> PSD P-M 7 0 14
-psdCalc(~yepmm,data=yepdf,species="Brown Trout",group="lentic")
+#> PSD-Q 58 43 72
+#> PSD-P 10 1 19
+#> PSD S-Q 42 28 57
+#> PSD Q-P 48 33 62
+#> PSD P-M 10 1 19
+psdCalc(~len,data=tmp,species="Brown Trout (lotic)")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-Q 11 2 21
-#> PSD S-Q 89 79 98
-#> PSD Q-P 11 2 21
+#> PSD-Q 58 43 72
+#> PSD-P 10 1 19
+#> PSD S-Q 42 28 57
+#> PSD Q-P 48 33 62
+#> PSD P-M 10 1 19
#===== For species not in PSDlit ... don't include species and use addLens
-# Note that these are same data as above, but treated as different species
-psdCalc(~yepmm,data=yepdf,addLens=c("stock"=130,"quality"=200,"preferred"=250,
- "memorable"=300,"trophy"=380))
+# Note these are same data as above, but treated as species not in PSDlit
+psdCalc(~len,data=tmp,addLens=c("stock"=130,"quality"=200,"preferred"=250,
+ "memorable"=300,"trophy"=380))
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#> Estimate 95% LCI 95% UCI
-#> PSD-Q 40 27 54
-#> PSD-P 14 5 23
-#> PSD-M 5 0 10
-#> PSD S-Q 60 46 73
-#> PSD Q-P 27 15 38
-#> PSD P-M 9 1 17
-#> PSD M-T 5 0 10
+#> PSD-Q 71 56 85
+#> PSD-P 32 17 47
+#> PSD-M 9 0 18
+#> PSD S-Q 29 15 44
+#> PSD Q-P 38 23 54
+#> PSD P-M 23 10 36
+#> PSD M-T 9 0 18
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/psdVal.html b/docs/reference/psdVal.html index cee4e1e3..4d1d5722 100644 --- a/docs/reference/psdVal.html +++ b/docs/reference/psdVal.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1A logical that indicates whether just the literature source information should be returned (TRUE) or not. If TRUE this will NOT return any of the Gabelhouse length information.
Data.frame of Gabelhouse length categories for all species. Defaults to `PSDlit` and is generally not used by the user (this simplifies use of this function in psdAdd).
Finds the Gabelhouse lengths from data(PSDlit) for the species given in species. The species name must be spelled exactly (including capitalization) as it appears in data(PSDlit). Type psdVal() to see the list of species and how they are spelled.
Some species have length categories separated by sub-group. For example, length categories exist for both lentic and lotic populations of Brown Trout. The length values for a sub-group may be obtained by either including the species name in species and the sub-group name in group or by using the combined species and sub-group name, with the sub-group name in parentheses, in species. Both methods are demonstrated in the examples. Note that an error is returned if a species has sub-groups but neither method is used to define the sub-group.#'
A zero is included in the first position of the returned vector if incl.zero=TRUE. This is useful when computing PSD values with a data.frame that contains fish smaller than the stock length.
Additional lengths may be added to the returned vector with addLens. Names for these lengths can be included as names in addLens or separately in addNames. If addNames is NULL and addLens is not named then the default category names will be the lengths from addLens. The addLens argument is useful for calculating PSD values that are different from the Gabelhouse lengths.
See examples and this article for a demonstration.
@@ -128,40 +134,53 @@Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
Site built with pkgdown 2.1.2.
+Site built with pkgdown 2.2.0.
diff --git a/docs/reference/rcumsum.html b/docs/reference/rcumsum.html index 411b5353..744597e6 100644 --- a/docs/reference/rcumsum.html +++ b/docs/reference/rcumsum.html @@ -7,7 +7,7 @@ FSA - 0.10.0 + 0.10.1