match_pattern: Compares one column against patterns

Description Usage Arguments Details Value Examples

View source: R/match_pattern.R

Description

match_pattern compares one column of a data frame against a list of pattern.

Usage

1
match_pattern(df, colname, lst_pattern, strict = TRUE)

Arguments

df

a data frame.

colname

a character string specifying the colonne to compare against the list of pattern.

lst_pattern

a named list of pattern, should contains one or multiple vector. Each slot should be named.

strict

a boolean to indicate if the character string should match only some value in the vector (FALSE) or all values (TRUE) on the list of pattern.

Details

lst_pattern can contains multiple vector of pattern. The column selected is compared to each vector contained in the list pattern and return the name of the slot with the vector without any difference.

Value

match_pattern In case of a matching, the function will return a character vector, if not, it will return NULL

Examples

1
2
3
4
5
6
7
# To look at the year of expression of the province in Vietnam from the
# imhen data sets (meteorological data)
library(imhen)

df <- imhen::meteo_intagg_2008_2017 # get data for the years 2008-2017
# Allows to check the spatial expression is corresponding to the year
match_pattern(df, "province", vn_admin1_year)

choisy/dictionary documentation built on Aug. 21, 2019, 3:52 p.m.