Learn R Programming

distantia (version 2.0.0)

auto_distance_cpp: (C++) Sum Distances Between Consecutive Samples in a Time Series

Description

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")

Value

numeric

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"

See Also

Other Rcpp_auto_sum: auto_sum_cpp(), auto_sum_full_cpp(), auto_sum_path_cpp(), subset_matrix_by_rows_cpp()

Examples

Run this code
#simulate a time series
x <- zoo_simulate()

#compute auto distance
auto_distance_cpp(
  x = x,
  distance = "euclidean"
  )

Run the code above in your browser using DataLab