Format aggregated time-binned datasets for portal output
Source:R/export.R
format_aggregated_data.RdAdds human-readable date labels (day/week/month/year) to aggregated datasets. Supports two modes:
Municipal mode (
municipal = TRUE): expects a single data frame withdate_bin_startand addsmonthandyearcolumns.National mode (
municipal = FALSE): expects a list of data frames (e.g.,day,week,month,year), converts each todata.table, setsn_boatstonational_boats, and adds formatted date label columns.
Arguments
- aggregated
A data frame (municipal mode) or a list of data frames (national mode) containing a
date_bin_startcolumn.- municipal
Logical. If
TRUE, treataggregatedas a single municipal table; otherwise treat it as a list of time-binned tables.- national_boats
Numeric/integer. Total number of boats to assign to the
n_boatscolumn in national mode.
Value
The formatted aggregated object: a data.table (municipal mode) or
a list of data.tables (national mode) with added/updated label columns.