String Distance/Alignment Score Matrix
Description
Computes the Levenshtein edit distance or pairwise alignment score matrix for a set of strings.
Usage
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)

Arguments
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. 
Details
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.
Value
Returns an object of class "dist"
.
Author(s)
P. Aboyoun
See Also
dist, agrep, pairwiseAlignment, substitution.matrices
Examples
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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.