| MatchesIndices(HFWutils) | R Documentation |
returns indices whether patterns were matched succesfully in a character vector
MatchesIndices(x, patt,fixed=FALSE)
x |
~~Describe x here~~ |
patt |
~~Describe patt here~~ |
fixed |
~~Describe fixed here~~ |
returns two indices one correspoding to the character vector, abnother to the patterns
~Describe the value returned If it is a LIST, use
comp1 |
Description of 'comp1' |
comp2 |
Description of 'comp2' |
...
~~further notes~~
Felix Wittmann hfwittmann@gmail.com
~put references to the literature/web site here ~
~~objects to See Also as help, ~~~
# Example 1
Vector <- "sum(F17:G18)+G190*G2+ sum(A1:B2)"
patt <- '[A-F]+[0-9]+'
MatchesIndices (Vector,patt)
# $index_x
# sum(F17:G18)+G190*G2+ sum(A1:B2)
# TRUE
#
# $index_patt
# [A-F]+[0-9]+
# TRUE
# Example 2
MatchesIndices (c(Vector, "sum(A1:B2)"),patt)
# $index_x
# sum(F17:G18)+G190*G2+ sum(A1:B2) sum(A1:B2)
# TRUE TRUE
#
# $index_patt
# [A-F]+[0-9]+
# TRUE
# Example 3
MatchesIndices (x =c("Patrick Pasot, Patrick Schmidt","Patrick Denker"),
patt =c("Patrick","Schmidt")
) # Matches
# $index_x
# Patrick Pasot, Patrick Schmidt Patrick Denker
# TRUE TRUE
#
# $index_patt
# Patrick Schmidt
# TRUE TRUE
# Example 4
out <- MatchesIndices (x =c("Patrick Pasot, Patrick Schmidt","Patrick Denker"),
patt =c("Pat[a-z]+")
) # Matches
out
# $index_x
# Patrick Pasot, Patrick Schmidt Patrick Denker
# TRUE TRUE
#
# $index_patt
# Pat[a-z]+
# TRUE