Skip to content
Back to skills

Stringdist

ASecurity

R stringdist package for string distance. Use for approximate string matching and distance metrics.

  • 5 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 4, 2026
data

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill stringdist --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Stringdist?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Stringdist
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-stringdist/badge)](https://www.skillsdirectory.com/skills/leolin990405-stringdist)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: stringdist
description: R stringdist package for string distance. Use for approximate string matching and distance metrics.
---

# stringdist

Approximate string matching and string distance functions.

## String Distance

```r
library(stringdist)

# Single comparison
stringdist("hello", "hallo")

# Multiple comparisons
stringdist(c("hello", "world"), c("hallo", "word"))
```

## Distance Methods

```r
# Levenshtein (default)
stringdist("hello", "hallo", method = "lv")

# Optimal string alignment
stringdist("hello", "hallo", method = "osa")

# Damerau-Levenshtein
stringdist("hello", "hallo", method = "dl")

# Longest common substring
stringdist("hello", "hallo", method = "lcs")

# q-gram
stringdist("hello", "hallo", method = "qgram", q = 2)

# Cosine
stringdist("hello", "hallo", method = "cosine", q = 2)

# Jaccard
stringdist("hello", "hallo", method = "jaccard", q = 2)

# Jaro
stringdist("hello", "hallo", method = "jw")

# Jaro-Winkler
stringdist("hello", "hallo", method = "jw", p = 0.1)

# Soundex
stringdist("hello", "hallo", method = "soundex")
```

## Distance Matrix

```r
# Compute distance matrix
strings <- c("hello", "hallo", "hullo", "world")
stringdistmatrix(strings)

# Between two sets
stringdistmatrix(c("hello", "world"), c("hallo", "word"))
```

## Approximate Matching

```r
# Find closest match
amatch("hello", c("hallo", "world", "help"), maxDist = 2)

# All matches within distance
ain("hello", c("hallo", "world", "help"), maxDist = 2)
```

## String Grouping

```r
# Group similar strings
strings <- c("hello", "hallo", "hullo", "world", "word")
stringdist_grouping <- function(x, maxDist = 2) {
  d <- stringdistmatrix(x)
  hc <- hclust(as.dist(d))
  cutree(hc, h = maxDist)
}
```

## Phonetic Coding

```r
# Soundex
phonetic("hello", method = "soundex")

# Metaphone
phonetic("hello", method = "metaphone")
```

## Q-grams

```r
# Get q-grams
qgrams("hello", q = 2)

# Q-gram table
qgrams(c("hello", "world"), q = 2)
```

## Sequence Alignment

```r
# Get alignment
seq_dist("hello", "hallo", method = "lv")
seq_distmatrix(c("hello", "world"), c("hallo", "word"))
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.