get_common_values: Get the common values of two vectors

View source: R/operations.R

get_common_valuesR Documentation

Get the common values of two vectors

Description

This function prints and returns the common values of two vectors. The two vectors don't have to be the same length.

Usage

get_common_values(vec1, vec2, vector.values.str = "nodes", with.gt = TRUE)

Arguments

vec1

vector

vec2

vector

vector.values.str

string. Used for printing, it tell us what are the values of the two vectors (use plural form). Default value: "nodes".

with.gt

logical. Determines if the ">" sign will be appended for nice printing in an R notebook (use with the chuck option results = 'asis'). Default value: TRUE.

Value

the vector of the common values. If there is only one value in common, the vector.values.str gets the last character stripped for readability. If there are no common values, it returns NULL.

See Also

pretty_print_vector_values, pretty_print_string

Examples

vec1 = c(1,2,3)
vec2 = c(3,4,1)

common.names = get_common_values(vec1, vec2)


usefun documentation built on Sept. 15, 2024, 1:06 a.m.