lg: length( grep( ... ) )

Description Usage Arguments See Also Examples

View source: R/misc.R

Description

This is a wrapper to a length( grep( ... ) ). See examples for usage. Primarily intended for interactive, not programmatic, use.

Usage

1
lg(x, pattern, perl = TRUE, ...)

Arguments

x

a vector on which we attempt to match pattern on.

pattern

regex pattern passed to grep.

perl

boolean. use perl-compatible regular expressions?

...

additional arguments passed to grep.

See Also

re_exists

Examples

1
2
3
4
x <- c("apple", "banana", "cherry")
if( lg( x, "^ap" ) > 0 ) {
  print( "regular expression '^ap' found in 'x'" )
  }

GarrettMooney/moonmisc documentation built on Oct. 19, 2019, 7:51 p.m.