weight: Individual or Catch Weight

View source: R/weight.R

weightR Documentation

Individual or Catch Weight

Description

Returns an estimate of the weight of individual organisms for a specified length. Estimated weights of sample subsets can also be calculated.

This function makes use of a set of allometric length-weight coefficients to estimate the weight of an organism given its length. The species must be specified and the sex may be specified for dimorphic species.

If year is specified, then survey data is loaded and the length-weight coefficients are calculated directly.

Usage

weight(x, ...)

## Default S3 method:
weight(x, species, sex, coefficients, units = "kg", ...)

## S3 method for class 'scsbio'
weight(x, category, by, as.hard.shelled = FALSE, units = "g", ...)

## S3 method for class 'scobs'
weight(x, ...)

Arguments

x

A numerical vector of organism lengths, or alternatively, a frequency table or a data frame of length-frequencies as produced by freq. The presence of ‘species’, ‘sex’ or ‘year’ fields in the data frame will be passed onto the corresponding function arguments.

...

Further arguments.

species

Species code.

sex

Numerical code specifying sex.

coefficients

A two-element numerical vector specifying the a and b coefficients, respectively. The the ‘a’ coefficient is assumed to be on the log-10 scale and the units in grams.

units

Units of the weight vector to be returned. It may be either in grams (units = "g") or kilograms (units = "kg").

category

A character string specifying a snow crab or crustacean category for syntax.

by

Character string(s) specifying the fields by which to group the estimated weights.

as.hard.shelled

Logical value specifying whether crustaceans are to assumed to be hard-shelled. Deafault is FALSE.

year

Survey years to use as data when calculating the length-weight coefficients. If left unspecified, a table of default values are used.

probability

Logical value specifying whether maturity values are to be filled in with probabilities when morphometric values are unavailable. In this case, the numbers returned may be non-integer values.

Value

Returns a numerical vector the same size as length containing the expected weight of an organism for a given length measurement.

Methods (by class)

  • weight(default): Default weight function.

  • weight(scsbio): Weight function for scsbio objects.

  • weight(scobs): Weight function for scobs objects.

Examples

# Weights for Atlantic cod:
weight(0:100, species = 10)

# Weights for female white hake:
weight(0:100, species = 12, sex = 2)

# Weights for female white hake based on 2010 September survey data:
weight(0:100, species = 12, sex = 2, year = 2010)

# Weights for white hake based on pooled sexes and data from 2010-2013 September surveys:
weight(0:100, species = 12, sex = 2, year = 2010:2013)

# Transform length-frequencies to weight-length:
x <- read.gulf(year = 2014, species = 40, card = "len")

# Simple example:
f <- freq(x, scale = TRUE)  # Pooled length-frequencies.
weight(f, species = 40)

# Length-frequencies by stratum and sex:
f <- freq(x, scale = TRUE, by = c("species", "stratum", "sex"))
weight(f)

# Length-frequencies by stratum and sex, use RV 2014 length-eight coefficients:
f <- freq(x, scale = TRUE, by = c("species", "stratum", "sex", "year"))
weight(f)

# Load 2010 snow crab data:
x <- read.scsbio(year = 2012)

# Calculate weight for each crab:
weight(x)

# Calculate weights by tow:
weight(x, by = "tow.number")

# Calculate total weights by day:
weight(x, by = c("year", "month", "day"), category = c("TM", "TMM", "TMSC12", "TMSC345"))

TobieSurette/gulf.data documentation built on Jan. 19, 2025, 7:50 p.m.