Description Usage Arguments Details Value See Also Examples
Hamming distance is defined on categorical vectors. It counts the number of times the coordinates in two data vectors differ, or the number of substitutions required to convert one data vector into the other. Here the Hamming distance is normalized, so the result is the number of coordinates that differ divided by the vector length.
1 | hammingD(dat)
|
dat |
dat should be a matrix or data frame of data. n is the number of observations (rows) and p is the number of dimensions (columns). |
This function calculates the Hamming distance (normalized) between rows of the input data.
The result is a nxn matrix whose (i,j) element is the Hamming distance between rows i and j
See Also as alphadata,
1 2 3 4 5 6 7 8 9 | ### The running is time consuming
### Run hamming distance
#dis0<-hammingD(alphadata)
### Save as distance format
#REDIST<-as.dist(dis0)
### Run a hierarchical clustering using average linkage
#hc0 <- hclust(REDIST,method = "average")
### plot the dendrogram
#plot(hc0,label=xlab1,hang =-1)
|
Loading required package: dendextend
---------------------
Welcome to dendextend version 1.5.2
Type citation('dendextend') for how to cite the package.
Type browseVignettes(package = 'dendextend') for the package vignette.
The github page is: https://github.com/talgalili/dendextend/
Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
Or contact: <tal.galili@gmail.com>
To suppress this message use: suppressPackageStartupMessages(library(dendextend))
---------------------
Attaching package: 'dendextend'
The following object is masked from 'package:stats':
cutree
Loading required package: ggplot2
Loading required package: ggdendro
Attaching package: 'ggdendro'
The following object is masked from 'package:dendextend':
theme_dendro
Loading required package: seqinr
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.