| Title: | Matches Strings to Most Similiar String |
|---|---|
| Description: | Package to find similiarity between character vectors. |
| Authors: | David Sjoberg [aut, cre] |
| Maintainer: | David Sjoberg <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-10-19 20:55:44 UTC |
| Source: | https://github.com/davidsjoberg/similiars |
Returns a case_when from dplyr to replace .s with .r. You can copy the output and put in the script to avoid manual work.
case_when_skeleton(.s, .r, var_name = NULL)case_when_skeleton(.s, .r, var_name = NULL)
.s |
a character vector to be replaced. |
.r |
a character vector to replace with. |
var_name |
Optional. the name of the variable that should be replaced. If NULL or not changed the call of '.s' is used. |
console output with a case_when skeleton
case_when_skeleton(letters[1:10], LETTERS[1:10], var_name = "my_letters")case_when_skeleton(letters[1:10], LETTERS[1:10], var_name = "my_letters")
Returns a vector of most similar string in another vector. Returns a vector of the same length as input vector '.s'.
find_most_similar_string( .s, .t, max_dist = Inf, verbose = TRUE, ignore_case = TRUE, feeling_lucky = FALSE, ... )find_most_similar_string( .s, .t, max_dist = Inf, verbose = TRUE, ignore_case = TRUE, feeling_lucky = FALSE, ... )
.s |
a character vector to be matched. |
.t |
a character vector to be matched against. |
max_dist |
the maximum string distance |
verbose |
should warnings be printed in the console. |
ignore_case |
should case be ignored? Default is TRUE. |
feeling_lucky |
if multiple most similar strings are found. Should the first one be returned? |
... |
other arguments passed to utils::adist. |
Uses the generalized Levenshtein distance. For more information type ?utils::adist in the console.
a character vector
find_most_similar_string(c("battman", "Irn Man"), superheroes)find_most_similar_string(c("battman", "Irn Man"), superheroes)
Returns a list of dataframes arranged by most similar strings.
find_string_distance(.s, .t, ignore_case = TRUE, ...)find_string_distance(.s, .t, ignore_case = TRUE, ...)
.s |
a character vector to be matched. |
.t |
a character vector to be matchad against. |
ignore_case |
should case be ignored? Default is TRUE. |
... |
other arguments passed to utils::adist. |
Uses the generalized Levenshtein distance. For more information type ?utils::adist in the console.
a list of dataframes
find_string_distance("battman", superheroes)find_string_distance("battman", superheroes)
A character vector with 46 super heroes
superheroessuperheroes
A character vector with 46 super heroes:
https://www.britannica.com/topic/list-of-superheroes-2024795