Learn R Programming

fb4package (version 2.0.0)

build_composition_df: Build a body-composition data frame from a list of composition results

Description

Internal helper shared by analyze_composition_by_size() and analyze_composition_changes(). Converts a list of calculate_body_composition() outputs into a tidy data frame, avoiding duplication of the identical sapply + data.frame block.

Usage

build_composition_df(compositions, weights)

Value

Data frame with columns Weight, Water_g,

Protein_g, Ash_g, Fat_g, and the corresponding

*_fraction and Energy_density columns.

Arguments

compositions

List of results from calculate_body_composition(), one element per weight point or time step.

weights

Numeric vector of fish weights corresponding to each element.