Learn R Programming

cwhmisc (version 6.0)

grepno: Grep utility

Description

Show elements passing or not a grep.

Usage

grepnot(s,x,value=TRUE)

Arguments

s,x
String
value
Boolean

Value

Elements

Details

s String regular expression, see link{grep}. x Array of strings to check with grep. value Third argument to grep proper. (strings which TRUE) "\" (strings with FALSE), "\" stands for "NOT"

Examples

Run this code
x <- c("Ab"," d","#12","  ",".1", "m.","",  "$y")
y <- c(".x", " .","c.",  "$y", "_p","12")
grepnot("^A[[:alpha:]]+",x) #  "Ab"  "\"  " d"  "#12" "  "  ".1"  "m."  ""    "$y"
grepnot("A[[:alpha:]]+",x)  #  "Ab"  "\"  " d"  "#12" "  "  ".1"  "m."  ""    "$y"
grepnot("a[[:alpha:]]+",x) # "\" ...
grepnot("#[[:alnum:]]+",x) #  "#12" "\" ...
grepnot("$",x) #  ""    "\" ...
grepnot("[^$][[:alnum:]].]+",x) # "\" ...
grepnot("[^[$]][[:alnum:]].]+",x) # "\" ...
grepnot("^.[[:alpha:]]+",x,FALSE) # "1"   "2"   "\" "3"   "4"   "5"   "6"   "7" 

Run the code above in your browser using DataLab