match_grep: Regular expression based extraction

Description Usage Arguments Value

View source: R/data_cleaner.R

Description

This function does a regular expression based search for each name in one vector for the values in the other vector and returns a named vector with names as the matched names and values as given in the queried vector.

Usage

1
2
match_grep(grep_vec, actual_names, use_values = F, return_names = F,
  echo = F)

Arguments

grep_vec

A named vector with the names to be searched for and the values, which the matching names should hold. It can also be a unnamed vector of names to search for.

actual_names

A vector giving the names in which the search is to be made

use_values

Logical value. (TRUE) if the values in the grep_vec are to be used for searching. Defualut is FALSE

return_names

Logical value (TRUE) if just want to return the matching names and not the values. Defualut is FALSE

echo

Logical value(TRUE) To print for each name in the grep_vec, which values in actual_names match and didnt match. Default is FALSE

Value

A named vector with the matched names and substituted values or a vector of macthed names


timelineR documentation built on Jan. 11, 2020, 9:11 a.m.