Skip to contents

This function provides a complete workflow for converting between aggregated fish data and individual fish records, ensuring all score categories are preserved.

Usage

convert_fish_data(
  data,
  direction,
  treatment_col = "tmt",
  replicate_col = "tank",
  score_prefix = "S",
  score_col = "score",
  total_col = "total",
  all_scores = NULL
)

Arguments

data

A data frame containing either aggregated or individual fish data

direction

Either "to_individual" or "to_aggregated"

treatment_col

Name of the column containing treatment groups (default: "tmt")

replicate_col

Name of the column containing tank/replicate IDs (default: "tank")

score_prefix

Prefix used for score columns when direction is "to_individual" (default: "S")

score_col

Name of the column containing scores when direction is "to_aggregated" (default: "score")

total_col

Name of the column containing/for total counts (default: "total")

all_scores

Optional vector of all score categories to include when direction is "to_aggregated"

Value

A data frame with the converted data