Description Usage Arguments Value Examples
View source: R/bootstrap_methods.R
For each value in new_vector, we find the indices of ALL matching values in orig_vector. This means that if new_vector has duplicates, we'll duplicate the indices from orig_vector too
1 | gen_vector_match(orig_vector, new_vector, current_index = vector("integer", 0))
|
orig_vector |
Vector to find indices from. |
new_vector |
Vector to match values to (from |
current_index |
Accumulator of the indices so far, for recursion. |
Returns a vector of indices from orig_vector that correspond to values in new_vector.
1 2 3 4 5 6 7 8 | ## Not run:
orig_vector <- c(1, 1, 2, 3, 3, 3)
new_vector <- c(1, 2, 1)
vector_match <- gen_vector_match(orig_vector, new_vector)
## testthat::expect_equal(vector_match, c(1, 2, 3, 1, 2))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.