Learn R Programming

fb4package (version 2.0.0)

update_body_composition: Update body composition during simulation (Mid-level)

Description

Updates body composition as fish grows or changes condition Used during simulation loops - assumes pre-validated inputs

Usage

update_body_composition(
  old_weight,
  new_weight,
  old_composition = NULL,
  processed_composition_params
)

Value

A named list with the same 13 elements as

calculate_body_composition, describing the body composition at new_weight. If old_composition is supplied, an additional element changes is appended — a named list with five numeric scalars: weight_change, water_change, protein_change,

fat_change, and energy_density_change (all in the same units as the corresponding composition elements).

Arguments

old_weight

Previous weight (g)

new_weight

New weight (g)

old_composition

Previous composition (optional)

processed_composition_params

List with processed composition parameters

Examples

Run this code
params <- list(water_fraction = 0.72, fat_energy = 36450,
               protein_energy = 17990, max_fat_fraction = 0.30)
old <- calculate_body_composition(weight = 100,
                                  processed_composition_params = params)
update_body_composition(old_weight = 100, new_weight = 110,
                        old_composition = old,
                        processed_composition_params = params)

Run the code above in your browser using DataLab