indexing-function
for the mbte-packageR/extract_subsignals.R
mbte_default_indexer.Rd
A subsignal is defined as a sequence of nonzero values in x
.
Therefore, elements near 0 are discarded and only the remaining nonzero
elements of x
are kept.
mbte_default_indexer(x, ...)
x | A numeric vector (signal-values - see |
---|---|
... | Additional arguments (currently ignored) |
# create a dummy vector, simulating measurement data # NOTE: the values of `x` are the same as their index x <- c(1:4, 0, 6:8, 0, 0, 11:15) x#> [1] 1 2 3 4 0 6 7 8 0 0 11 12 13 14 15# NOTE: start indices: c(1, 6, 11) # end indices: c(4, 8, 15) indices <- mbte_default_indexer(x) indices#> $start #> [1] 1 6 11 #> #> $end #> [1] 4 8 15 #># show first subsignal: x[indices$start[1]:indices$end[1]] # c(1, 2, 3, 4)#> [1] 1 2 3 4