analyze_composition_changes: Analyze composition changes with growth

View source: R/15.2-analysis-nutritional.R

analyze_composition_changesR Documentation

Analyze composition changes with growth

Description

Analyzes how body composition changes as fish grow during a simulation. Useful for understanding ontogenetic changes in energy density and macronutrient allocation.

Usage

analyze_composition_changes(result, processed_composition_params)

Arguments

result

FB4 result object with daily output

processed_composition_params

Processed composition parameters

Value

A data.frame with one row per simulation day and thirteen columns: Weight (g), Water_g, Protein_g, Ash_g, Fat_g (g), Water_fraction, Protein_fraction, Ash_fraction, Fat_fraction (dimensionless), Energy_density (J/g), Day (integer), Energy_density_change (J/g/day; NA on day 1), Fat_fraction_change, and Protein_fraction_change (change per day; NA on day 1). Stops with an error if result has no daily_output.

Examples


data(fish4_parameters)
sp   <- fish4_parameters[["Oncorhynchus tshawytscha"]]$life_stages$adult
info <- fish4_parameters[["Oncorhynchus tshawytscha"]]$species_info
bio  <- Bioenergetic(
  species_params     = sp,
  species_info       = info,
  environmental_data = list(
    temperature = data.frame(Day = 1:30, Temperature = rep(12, 30))
  ),
  diet_data = list(
    proportions = data.frame(Day = 1:30, Prey1 = 1.0),
    energies    = data.frame(Day = 1:30, Prey1 = 5000),
    prey_names  = "Prey1"
  ),
  simulation_settings = list(initial_weight = 100, duration = 30)
)
bio$species_params$predator$ED_ini <- 5000
bio$species_params$predator$ED_end <- 5500
result      <- run_fb4(bio, strategy = "direct", p_value = 0.5, verbose = FALSE)
comp_params <- process_composition_params(list())
df <- analyze_composition_changes(result, comp_params)


fb4package documentation built on May 8, 2026, 1:07 a.m.