make_equitimed: Insert rows if necessary so that time series are evenly...

Description Usage Arguments Details Value

View source: R/utils-data-processing.R

Description

Insert rows if necessary so that time series are evenly sampled

Usage

1
2
3
4
5
6
7
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.

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.

Value

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


weecology/MATSS documentation built on May 15, 2020, 7:03 p.m.