multiGrep {maDB} | R Documentation |
multiGrep
This function can be used, if one wants to know the position of a list of patterns inside a vector.
multiGrep(pattern,x,...)
pattern |
The string, or a vector of strings that should be searched in the submitted data. |
x |
The data, any kind of string or vector. |
... |
Some additional parameters for the myGrep and grep commands that are executed inside the function. |
The functions performs a myGrep
call for each of the patterns submitted and returns a vector with the indizes where the patterns where found inside the data vector.
Johannes Rainer
test <- c("where","is","the","pattern","in","this","vector","?") multiGrep(pattern="patt",test) test[multiGrep(pattern="patt",test)] multiGrep(pattern=c("the","tor","is","where"),test) test[multiGrep(pattern=c("the","tor","is","where"),test)]