extract.compared.vectors {veccompare} | R Documentation |
Extract elements from the output of compare.vectors
Description
Straightforwardly extract particular elements from the output of compare.vectors
.
Usage
extract.compared.vectors(output_from_compare.vectors, vector_names = NULL,
only_match_vector_names = FALSE, degrees_of_comparison = NULL,
elements_of_output = NULL)
Arguments
output_from_compare.vectors |
The list output of |
vector_names |
An optional vector of names to extract from the named list ( |
only_match_vector_names |
A logical (TRUE/FALSE) indicator whether to match only |
degrees_of_comparison |
An optional number of vector of numbers indicating which degrees of comparison to return (for example, 2 will return only two-way comparisons from |
elements_of_output |
An optional vector of element names from |
Value
A winnowed version of output_from_compare.vectors
. Depending on arguments, either a list, a vector, or a string.
Examples
example <- veccompare::compare.vectors(veccompare::example.vectors.list)
# To extract similar elements across list items:
veccompare::extract.compared.vectors(
example,
elements_of_output = "elements_involved"
)
# To extract all comparisons that involve "vector_a":
veccompare::extract.compared.vectors(
example,
vector_names = "vector_a"
)
# To find all comparisons that were about "vector_a" and "vector_c":
veccompare::extract.compared.vectors(
example,
vector_names = c("vector_a", "vector_c"),
only_match_vector_names = TRUE
)
# To get all elements that did a two-way comparison:
veccompare::extract.compared.vectors(
example,
degrees_of_comparison = 2
)
# A more complex / specific example:
extract.compared.vectors(
example,
vector_names = c("vector_a", "vector_c"),
only_match_vector_names = FALSE,
degrees_of_comparison = c(2, 3),
elements_of_output = "elements_involved"
)