belong9: indicates inclusion of character string

Description Usage Arguments Details Value Examples

View source: R/rbsa0.code.r

Description

Checks if some string(s) belong(s) to a series of strings. When exact is FALSE, returns TRUE if the character string sch is included at least once into the character string ch.
sch can be a vector, in that case, the check is made for each of its components. According to how the returned value is vectorial or scalar. When sch is zero length then TRUE is returned. When ch is zero length then FALSE is returned except when length(sch) is zero.

Usage

1
2
3
 
  belong9(sch,ch,exact=FALSE,how="a",lower=FALSE,
          monitor=rbsa0$monitor$v) 

Arguments

sch

The character string(s) to be found.

ch

The character string(s) to investigate.

exact

When exact, one component must be strictly identical, if not a subtring is sufficient. See also the Details section for two other possibilities.

how

Indicates what to do when length(sch)>1. The choice are v: a logical vector gives back each check independently; 1: returns TRUE when at least one of the component belongs to the series ch and a when all components must comply to get TRUE.

lower

Must the comparisons being done after case lowering?

monitor

List of constants indicating the monitoring choices, see the rbsa0$monitor$v provided object as an example.

Details

More possibilities exists when exact is 6 or 8. Namely that the substring must be at the end or at the beginning of the reference chain.

Value

A logical vector with length of sch; or TRUE or FALSE when how is 1 or a.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 
  belong9('a','non'); 
  belong9('o',c('non','oui')); 
  belong9('o',c('non','oui'),6); 
  belong9('o',c('non','oui'),8); 
  belong9('O',c("oui")); 
  belong9('O',c("oui"),lower=TRUE); 
  belong9(c('o','n'),c('non','oui'),6,how='v'); 
  belong9(c('o','n'),c('non','oui'),8,how='v'); 
  belong9(c("o","oui"),c('non','oui')); 
  belong9(c("o","oui"),c('non','oui'),how="v"); 
  belong9(c("A[SEX]","A[AGE]"),c("A[AGE]","A[SEX]"),how="a") 

rbsa documentation built on May 31, 2017, 4:29 a.m.