Learn R Programming

sjPlot (version 1.7)

group_str: Group near elements of string vectors

Description

This function groups elements of a string vector (character or string variable) according to the element's distance. The more similar two string elements are, the higher is the chance to be combined into a group.

Usage

group_str(strings, maxdist = 3, method = "lv", strict = FALSE,
  trim.whitespace = TRUE, remove.empty = TRUE, showProgressBar = FALSE)

Arguments

Value

A character vector where similar string elements (values) are recoded into a new, single value.

See Also

str_pos

Examples

Run this code
oldstring <- c("Hello", "Helo", "Hole", "Apple", "Ape", "New", "Old", "System", "Systemic")
newstring <- group_str(oldstring)
sjt.frq(data.frame(oldstring, newstring), removeStringVectors = FALSE, autoGroupStrings = FALSE)

newstring <- group_str(oldstring, strict = TRUE)
sjt.frq(data.frame(oldstring, newstring), removeStringVectors = FALSE, autoGroupStrings = FALSE)

Run the code above in your browser using DataLab