
Last chance! 50% off unlimited learning
Sale ends in
group_str(strings, maxdist = 2, method = "lv", strict = FALSE, trim.whitespace = TRUE, remove.empty = TRUE, showProgressBar = FALSE)
"lv"
. See
stringdist
for details.TRUE
, value matching is more strictly. See 'Examples'.TRUE
(default), leading and trailing white spaces will
be removed from string values.TRUE
(default), empty string values will be removed from the
character vector strings
.TRUE
, the progress bar is displayed when computing the distance matrix.
Default in FALSE
, hence the bar is hidden.strings
, i.e. grouped elements appear multiple times, so
the count for each grouped string is still avaiable (see 'Examples').
str_pos
oldstring <- c("Hello", "Helo", "Hole", "Apple",
"Ape", "New", "Old", "System", "Systemic")
newstring <- group_str(oldstring)
# see result
newstring
# count for each groups
table(newstring)
## Not run:
# library(sjPlot)
# # print table to compare original and grouped string
# sjt.frq(data.frame(oldstring, newstring),
# removeStringVectors = FALSE,
# autoGroupStrings = FALSE)
#
# # larger groups
# newstring <- group_str(oldstring, maxdist = 3)
# sjt.frq(data.frame(oldstring, newstring),
# removeStringVectors = FALSE,
# autoGroupStrings = FALSE)
#
# # be more strict with matching pairs
# newstring <- group_str(oldstring, maxdist = 3, strict = TRUE)
# sjt.frq(data.frame(oldstring, newstring),
# removeStringVectors = FALSE,
# autoGroupStrings = FALSE)## End(Not run)
Run the code above in your browser using DataLab