get_common_names: Get the common names of two vectors

Description Usage Arguments Value See Also Examples

View source: R/operations.R

Description

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

Usage

1
2
get_common_names(vec1, vec2, vector.names.str = "nodes",
  with.gt = TRUE)

Arguments

vec1

vector with names attribute

vec2

vector with names attribute

vector.names.str

string. Used for printing, it tell us what are the names 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 character vector of the common names. If there is only one name in common, the vector.names.str gets the last character stripped for readability. If there is no common names, it returns FALSE.

See Also

pretty_print_vector_values, pretty_print_string

Examples

1
2
3
4
5
6
vec1 = c(1,1,1)
vec2 = c(1,2)
names(vec1) = c("a","b","c")
names(vec2) = c("c","b")

common.names = get_common_names(vec1, vec2)

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