WFS_util_check_in_list: Check a character value in a named list with character...

View source: R/WFS_utils.R

WFS_util_check_in_listR Documentation

Check a character value in a named list with character contents

Description

With the default parameters the function is checking without caring for lower and upper caps if a list has an entry with a certain name and value. When a name occurs more than once the first (if keep.first==TRUE) or last (otherwise) occurrence is examined. By specifying the ignore_case arguments to FALSE the user can indicate that the difference in lower and upper caps is important when comparing 'names' (in case of name_ignore_case ) and/or 'values' (in case of value_ignore_case ).

Usage

WFS_util_check_in_list(
  mylist,
  name,
  value,
  keep_first = T,
  name_ignore_case = T,
  value_ignore_case = T
)

Arguments

mylist

A named list with character contents

name

Character string with the name of the entry that is searched

value

A character scalar to check for in the name entry

name_ignore_case

Logical scalar indicating if case is ignored when searching for the name

value_ignore_case

Logical scalar indicating if case is ignored when checking the value

keep.first

Logical scalar indicating if the first (when TRUE) or last entry (when FALSE) with duplicate names will be used

Value

Logical value indicating if the name entry contains the value value

Examples

WFS_util_check_in_list(
    mylist = list(a='x',b='y',b='Y'),
    name = 'B',
    value = 'Y',
    value_ignore_case = F
  )
# [1] FALSE  # first entry B found with value y (unequal to Y)

HanOostdijk/HOQCwfs documentation built on March 6, 2023, 8:18 a.m.