get_common_values: Get the common values of two vectors

Description Usage Arguments Value See Also Examples

View source: R/operations.R

Description

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

Usage

1
2
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

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

common.names = get_common_values(vec1, vec2)

bblodfon/usefun documentation built on Nov. 13, 2019, 12:43 p.m.