# Simple example
DKI2(AMBI = 1.61, H = 2.36, N = 25, psal = 21.4)
# ------ Example workflow for calculating DKI (v2) from species counts ----
# calculate AMBI index
dfAMBI <- AMBI(test_data, by = c("station"), var_rep = "replicate")[["AMBI"]]
# show AMBI results
dfAMBI
# add salinity values - these are realistic but invented values
dfAMBI <- dplyr::mutate(dfAMBI, psal=ifelse(station == 1, 21.3, 26.5))
# calculate DKI from AMBI results
dfAMBI <- dplyr::mutate(dfAMBI, DKI=DKI2(AMBI, H, N, psal))
Run the code above in your browser using DataLab