Skip to contents

This helper inspects a total-individuals column and returns the minimum positive value that can be used as a common N for fairer comparisons.

Usage

timefish_minimum_individuals(
  data,
  total_col,
  group_cols = NULL,
  save_minimum = FALSE,
  ask_save = FALSE
)

Arguments

data

A data frame.

total_col

Column name with total individuals.

group_cols

Optional grouping columns to display in the summary table.

save_minimum

Logical. If TRUE, save the estimated minimum in options(timefishr.minimum_individuals = <value>).

ask_save

Logical. If TRUE and interactive, ask whether to save the value in options.

Value

A list with minimum_individuals, reference_rows, and summary_table.

Examples

dat <- data.frame(
  location = c("A", "B", "C"),
  total_abun = c(100, 80, 120)
)
timefish_minimum_individuals(dat, total_col = "total_abun", group_cols = "location")
#> $minimum_individuals
#> [1] 80
#> 
#> $reference_rows
#> [1] 2
#> 
#> $summary_table
#>   location row_id total_individuals
#> 1        B      2                80
#> 2        A      1               100
#> 3        C      3               120
#>