Displaying 1 result from an estimated 1 matches for "abchijk".
Did you mean:
abchak
2010 Jun 12
2
Logic with regexps
...ep
on 'rex2', illustrated by the following example:
## Given character vector X (below), and two regular exdpressions
## rex1="abc", rex2="ijk", to return the elements of X which match
## rex1 AND do not match rex1:
X <- c(
"abcdefg", # Yes
"abchijk", # No
"mnopqrs", # No
"ijkpqrs", # No
"abcpqrs" ) # Yes
rex1 <- "abc"
rex2 <- "ijk"
ix1<- grep(rex1,X)
ix2<- grep(rex2,X)
X[ix1[!(ix1 %in% ix2)]]
## [1] "abcdefg" "abcpqrs"
Question...