subset_matrix_by_rows_cpp: (C++) Subset Matrix by Rows

View source: R/RcppExports.R

subset_matrix_by_rows_cppR Documentation

(C++) Subset Matrix by Rows

Description

Subsets a time series matrix to the coordinates of a trimmed least-cost path when blocks are ignored during a dissimilarity analysis.

Usage

subset_matrix_by_rows_cpp(m, rows)

Arguments

m

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

rows

(required, integer vector) vector of rows to subset from a least-cost path data frame.

Value

numeric matrix

See Also

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

Examples

#simulate a time series
m <- zoo_simulate(seed = 1)

#sample some rows
rows <- sample(
  x = nrow(m),
  size = 10
  ) |>
  sort()

#subset by rows
m_subset <- subset_matrix_by_rows_cpp(
  m = m,
  rows = rows
  )

#compare with original
m[rows, ]


distantia documentation built on April 4, 2025, 5:42 a.m.