Skip to contents

Computes the cumulative sum of distances between consecutive samples in a univariate or multivariate time series. NA values should be removed before using this function.

Usage

auto_distance_cpp(x, distance = "euclidean")

Arguments

x

(required, numeric matrix) univariate or multivariate time series.

distance

(optional, character string) distance name from the "names" column of the dataset distances (see distances$name). Default: "euclidean"

Value

numeric

Examples

#simulate a time series
x <- zoo_simulate()

#compute auto distance
auto_distance_cpp(
  x = x,
  distance = "euclidean"
  )
#> [1] 10.61317