str_pos(searchString, findTerm, maxdist = 2, part.dist.match = 0, showProgressBar = FALSE)
searchString
.searchString
. Following values are accepted:
findTerm
are extracted from searchString
matching
findTerm
as well as strings with a slightly wider range are extracted from searchString
matching
Default value is 0. See 'Details' for more information.
TRUE
, the progress bar is displayed when computing the distance matrix.
Default in FALSE
, hence the bar is hidden.searchString
that
partially match or are similar to findTerm
. Returns -1
if no
match was found.
part.dist.match = 1
, a substring of length(findTerm)
is extracted
from searchString
, starting at position 0 in searchString
until
the end of searchString
is reached. Each substring is matched against
findTerm
, and results with a maximum distance of maxdist
are considered as "matching". If part.dist.match = 2
, the range
of the extracted substring is increased by 2, i.e. the extracted substring
is two chars longer and so on.
group_str
## Not run:
# string <- c("Hello", "Helo", "Hole", "Apple", "Ape", "New", "Old", "System", "Systemic")
# str_pos(string, "hel") # partial match
# str_pos(string, "stem") # partial match
# str_pos(string, "R") # no match
# str_pos(string, "saste") # similarity to "System"
#
# # finds two indices, because partial matching now
# # also applies to "Systemic"
# str_pos(string,
# "sytsme",
# part.dist.match = 1)
#
# # finds nothing
# str_pos("We are Sex Pistols!", "postils")
# # finds partial matching of similarity
# str_pos("We are Sex Pistols!", "postils", part.dist.match = 1)## End(Not run)
Run the code above in your browser using DataLab