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