tidy-moment API
Dependency: moment >= 2.0.0
Note these functions are not included in the core tidy.js package and must be installed separately.
#
summarizeMomentGranularitySummarizes input data into bins set by a granularity (day, week, month, year) of UTC moment dates. Assumes input data is by day. By default uses date
and timestamp
as the keys to track the date, but can be configured via options.
Typically used as a precursor to a moving average computed by a subsequence mutate({ value: roll(...) })
command.
#
Parametersgranularity
#
summarizeSpec
#
Mapping from key to summary functions, the same as used in summarize.
options?
#
dateKey = 'date'
: The key in the input objects where the UTC moment dates are stored. Will be modified to be at the specified granularity.timestampKey = 'timestamp'
: An ISO string of the rolled up date will be saved on this key.rest = first
: The same as used in summarize, defaults to first value encountered.