View source: R/pairwise_hamming.R
pairwise_hamming | R Documentation |
Calculates the pairwise Hamming/Manhattan distance (these are equivalent with binary/dichotomous data). The normalized verision is equivalent to the probability of union.
pairwise_hamming(data, cols, case_weights, norm = FALSE)
pairwise_manhattan(data, cols, case_weights, norm = FALSE)
pairwise_discordant(data, cols, case_weights, norm = FALSE)
data |
A data frame. |
cols |
Columns to analyze. |
case_weights |
An optional column of case weights. |
norm |
Whether or not to normalize the distance, default is |
Metric: Distance
Symmetrical: Yes
Upper Limit: Inf (1 when normalized)
Lower Limit: 0
B | |||
1 | 0 | ||
A | 1 | a | b |
0 | c | d | |
Hamming = b+c
Normalized = (b+c)/N
A matrix.
res <- pairwise_hamming(
data = FoodSample,
cols = Bisque:Turkey
)
print(res)
tidy(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.