Insert rows if necessary so that time series are evenly sampled

make_equitimed(
  data,
  period = NULL,
  tol = 1e-06,
  method = c("mean", "method", "closest"),
  na.rm = TRUE
)

Arguments

data

dataset to modify

period

period to check the times against (if NULL, first check to see if there is a known period set in the metadata, otherwise assumes 1)

tol

tolerance for the period

method

one of c("mean", "method", "closest") that determines how the rows of the original data will get coerced into the output here.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Value

the dataset, with rows coerced according to the equitimed time indices, and additional empty rows inserted if needed

Details

First, get_full_times() computes the sequence of time index values at a regular sampling interval of period. These will be the final time index values for the output. Some set of rows of the original dataset will map to each of these time indices.

The method argument determines how these rows get coerced:

mean

the values in the rows are averaged together using mean

median

the values in the rows are averaged together using median

closest

the values in the row that is closest in time to the desired time index are used.