Estimate the minimum number of individuals for rarefaction
timefish_minimum_individuals.RdThis 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 inoptions(timefishr.minimum_individuals = <value>).- ask_save
Logical. If
TRUEand interactive, ask whether to save the value in options.
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
#>