Resample or aggregate data in timetable, and resolve duplicate or irregular times

`TT2 = retime(`

returns a timetable that contains the variables from `TT1`

,`newTimeStep`

,`method`

)`TT1`

and
row times that are regularly spaced by the time step
`newTimeStep`

. The `retime`

function
resamples or aggregates data in the variables of `TT1`

using
the function specified by `method`

. You can use
`retime`

to:

Interpolate data values from

`TT1`

at different times.Aggregate data into time bins (for example, to create a timetable containing quarterly means from monthly data).

Remove rows from

`TT1`

that have duplicate row times.Make an irregular timetable into a regular timetable, since

`newTimeStep`

specifies regular row times.

The `newTimeStep`

input argument is a character vector or
string that specifies a predefined time step. For example, when
`newTimeStep`

is `'daily'`

, and
`method`

is `'mean'`

, then
`TT2`

contains the daily means of the data from
`TT1`

.

The first row time of `TT2`

is on the time step before the
earliest row time from `TT1`

. The row times in
`TT2`

cover the range of row times from
`TT1`

. However, `TT2`

might not include
any of the actual row times from `TT1`

, since
`TT1`

might not have any row times that fall on any of the
regular row times of `TT2`

.

To interpolate or fill in values in `TT2`

using different
methods for different variables, specify the
`VariableContinuity`

property of `TT1`

.
For more information, see Retime and Synchronize Timetable Variables Using Different Methods.

To resample or aggregate data from multiple timetables, see `synchronize`

.

`TT2 = retime(`

calculates regularly spaced row times using the time step `TT1`

,'regular',`method`

,'TimeStep',`dt`

)`dt`

.
The `dt`

input argument is a scalar duration or calendar
duration, specifying a time step of any size. The row times of
`TT2`

span the range of row times of
`TT1`

.

Use this syntax when the time step is not one of the predefined time steps you can specify as a character vector or string.

`TT2 = retime(`

adjusts the timetable variables data to the time vector
`TT1`

,`newTimes`

,`method`

)`newTimes`

, using the method specified by
`method`

. The `newTimes`

time vector can
be irregular, but it must be a sorted datetime or duration vector and contain
unique values. The times in `newTimes`

become the row times of
`TT2`

.

`TT2 = retime(`

adjusts timetable data using the `TT1`

,`newTimeStep`

)`'fillwithmissing'`

method.
`TT2`

has missing data indicators wherever
`TT2`

has a row time that does not match any row time in
`TT1`

.

If `TT1`

has rows with duplicate row times and
`TT2`

has row times that match the duplicates, then
`TT2`

contains the first row from each group of rows in
`TT1`

with duplicate row times that match.

`TT2 = retime(___,`

adjusts timetable data using additional options specified by one or more
`Name,Value`

)`Name,Value`

pairs. You can use this syntax with the input
arguments of any of the previous syntaxes.

Retime Timetable | Synchronize
Timetables | `horzcat`

| `innerjoin`

| `lag`

| `outerjoin`

| `resample`

| `synchronize`

| `vertcat`