prune_and_reorder_vector {usefun} | R Documentation |
Prune and reorder vector elements
Description
Given two vectors, the first one's elements are pruned and reordered according
to the common values of the second vector and the elements' names
(attribute) of the first. If there no common such values, an empty vector is
returned.
Usage
prune_and_reorder_vector(vec, filter.vec)
Arguments
vec |
a vector with |
filter.vec |
a character vector whose values will be used to filter the
|
Value
the pruned and re-arranged vector.
Examples
vec = c(1,2,3)
names(vec) = c("a","b","c")
filter.vec1 = c("a")
prune_and_reorder_vector(vec, filter.vec1)
filter.vec2 = c("c", "ert", "b")
prune_and_reorder_vector(vec, filter.vec2)
[Package usefun version 0.5.0 Index]