subset_matrix_by_rows_cpp {distantia} | R 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, ]
[Package distantia version 2.0.0 Index]