Computes the Levenshtein edit distance or pairwise alignment score matrix for a set of strings.
1 2 3 4 5 6 7 8 9 10  stringDist(x, method = "levenshtein", ignoreCase = FALSE, diag = FALSE, upper = FALSE, ...)
## S4 method for signature 'XStringSet'
stringDist(x, method = "levenshtein", ignoreCase = FALSE, diag = FALSE,
upper = FALSE, type = "global", quality = PhredQuality(22L),
substitutionMatrix = NULL, fuzzyMatrix = NULL, gapOpening = 0,
gapExtension = 1)
## S4 method for signature 'QualityScaledXStringSet'
stringDist(x, method = "quality", ignoreCase = FALSE,
diag = FALSE, upper = FALSE, type = "global", substitutionMatrix = NULL,
fuzzyMatrix = NULL, gapOpening = 0, gapExtension = 1)

x 
a character vector or an 
method 
calculation method. One of 
ignoreCase 
logical value indicating whether to ignore case during scoring. 
diag 
logical value indicating whether the diagonal of the matrix
should be printed by 
upper 
logical value indicating whether the upper triangle of the matrix
should be printed by 
type 
(applicable when 
quality 
(applicable when 
substitutionMatrix 
(applicable when

fuzzyMatrix 
(applicable when 
gapOpening 
(applicable when 
gapExtension 
(applicable when 
... 
optional arguments to generic function to support additional methods. 
When method = "hamming"
, uses the underlying neditStartingAt
code
to calculate the distances, where the Hamming distance is defined as the number
of substitutions between two strings of equal length. Otherwise, uses the
underlying pairwiseAlignment
code to compute the distance/alignment
score matrix.
Returns an object of class "dist"
.
P. Aboyoun
dist, agrep, pairwiseAlignment, substitution.matrices
1 2 3 4 5 6 7 8 9 10 11  stringDist(c("lazy", "HaZy", "crAzY"))
stringDist(c("lazy", "HaZy", "crAzY"), ignoreCase = TRUE)
data(phiX174Phage)
plot(hclust(stringDist(phiX174Phage), method = "single"))
data(srPhiX174)
stringDist(srPhiX174[1:4])
stringDist(srPhiX174[1:4], method = "quality",
quality = SolexaQuality(quPhiX174[1:4]),
gapOpening = 10, gapExtension = 4)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.