Aggregates species abundance data by temporal resolution, computing mean and standard error for visualization in time series plots. Uses dbplyr lazy evaluation for efficient database queries.
prep_ts_sp(df_sp, ts_res)data.frame with columns:
time - aggregated time value
name - species name
avg - mean standardized tally
std - standard error (sd/n)
n - number of observations
upr - upper confidence bound (avg + std)
lwr - lower confidence bound (avg - std)
For seasonal plots (ts_res = "quarter"), the function adds a wrapping
row to ensure visual continuity across the year boundary. Data is collected
from database before aggregation.
expr_time_sp for temporal transformation logic
plot_ts for visualization