Skip to contents

Computes Carlson's Trophic State Index (TSI/IET) from Secchi depth, chlorophyll-a, and total phosphorus. Returns component scores and the overall IET as the row-wise mean of available components.

You can also pass a data.frame as the first argument (see Details).

Usage

iet_carlson(secchi = NULL, clorofila = NULL, tp = NULL, .keep_ids = FALSE)

Arguments

secchi

Numeric vector with Secchi depth (m) or a data.frame containing columns named secchi (m), clorofila (ug/L) and tp (ug/L) or p_total (mg/L). If a data.frame is provided, clorofila and tp must be NULL.

clorofila

Numeric vector with chlorophyll-a (ug/L).

tp

Numeric vector with total phosphorus (ug/L).

.keep_ids

Logical; when a data.frame is provided, bind back common ID columns (rio, ponto, data, lat, lon). Default FALSE (keeps historical behaviour).

Value

A data frame with columns (when applicable):

  • TSI_Secchi — component from Secchi depth.

  • TSI_Chla — component from chlorophyll-a.

  • TSI_TP — component from total phosphorus.

  • IET — overall Carlson index (row mean).

Details

Implemented component formulas (Carlson 1977):

  • TSI_Secchi = 60 - 14.41 * log10(secchi)

  • TSI_Chla = 9.81 * log10(clorofila) + 30.6

  • TSI_TP = 14.42 * log10(tp) + 4.15

When a data.frame is provided, character inputs using comma decimal (e.g. "3,2") or inequality symbols (e.g. "<0,1") are safely converted to numeric. If p_total (mg/L) exists instead of tp (ug/L), it is converted internally (tp = p_total * 1000).

Inputs may contain NA and are recycled according to R rules. The overall index IET is the row mean of the available components (na.rm = TRUE).

References

Carlson, R. E. (1977). A trophic state index for lakes. Limnology and Oceanography, 22(2), 361–369. doi:10.4319/lo.1977.22.2.0361

Examples

# Vector usage (kept as-is)
secchi <- c(1.2, 0.8, 0.4)        # m
clorofila <- c(5, 12, 30)         # ug/L
tp <- c(20, 40, 70)               # ug/L
iet_carlson(secchi = secchi, clorofila = clorofila, tp = tp)
#>   TSI_Secchi TSI_Chla   TSI_TP      IET
#> 1   58.85900 37.45690 22.91085 39.74225
#> 2   61.39647 41.18677 27.25171 43.27832
#> 3   65.73432 45.09056 30.75631 47.19373

# Data frame usage (optional)
# df <- data.frame(secchi = secchi, clorofila = clorofila, p_total = c(0.02, 0.04, 0.07))
# iet_carlson(df)                  # auto-converts p_total (mg/L) to tp (ug/L)
# iet_carlson(df, .keep_ids = TRUE)