Learn R Programming

Tivy (version 0.1.1)

apply_catch_weighting: Apply catch weighting to data frame

Description

Applies catch weighting to length frequency columns in a data frame. Supports parallel processing for large datasets.

Usage

apply_catch_weighting(
  data,
  length_cols,
  catch_col,
  a,
  b,
  parallel = FALSE,
  num_cores = NULL,
  block_size = 10000,
  silence_warnings = TRUE
)

Value

Data frame with original columns plus weighted length columns (prefixed with "weighted_").

Arguments

data

Data frame containing length columns and catch data.

length_cols

Character vector of length column names.

catch_col

Name of the catch column.

a

Coefficient of the length-weight relationship.

b

Exponent of the length-weight relationship.

parallel

Logical. Use parallel processing.

num_cores

Number of cores for parallel processing. If NULL, auto-detect.

block_size

Block size for parallel processing.

silence_warnings

Logical. Suppress warnings.

Examples

Run this code
if (FALSE) {
length_cols <- c("8", "8.5", "9", "9.5", "10", "10.5", "11", "11.5")
weighted_data <- apply_catch_weighting(
  data = fishery_data,
  length_cols = length_cols,
  catch_col = "total_catch",
  a = 0.0001,
  b = 2.984
)
}

Run the code above in your browser using DataLab