map_indices | R Documentation |
This function maps indices from an input vector to corresponding sequences of
grouped indices. Each element from the input specifies a group to be mapped
from the sequence, determined by the grouping size n
.
map_indices(indices, n)
indices |
[ |
n |
[ |
This function is useful when working with indices arranged in fixed-size
groups, where each group can be referenced by a single index. For example, if
indices are structured in chunks of 3, calling this function with n = 3
will map the corresponding groups of 3 consecutive indices for the given
input indices, see the examples.
An integer
vector
, containing the mapped indices according to the
specified group size.
Other vector helpers:
check_numeric_vector()
,
check_probability_vector()
,
chunk_vector()
,
insert_vector_entry()
,
match_numerics()
,
permutations()
,
split_vector_at()
,
subsets()
,
vector_occurrence()
# Example: Map indices based on groups of 3
map_indices(c(1, 3, 5), 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.