| siml_idx | R Documentation |
This functions returns a numeric vector length 1.
siml_idx(x, y, method, vorder)
x |
a character or binary vector |
y |
a character or binary vector |
method |
One of the "jaccard", "simpson", "dice", "smc", and "tanimoto" |
vorder |
The 'x' and 'y' are oredered vectors or not. |
a numeric vector
# character vector
v1 <- c("a", "b", "c", "d")
v2 <- c("a", "b", "e", "f")
siml_idx(v1, v2, method="jaccard")
siml_idx(v1, v2, method="simpson")
siml_idx(v1, v2, method="smc")
siml_idx(v1, v2, method="dice")
# Two sets of different size
v1 <- c("a", "b", "c")
v2 <- c("a", "b", "d", "e")
siml_idx(v1, v2, "smc")
# ordered categorical vector
ov1 <- c("3", NA, NA, "3", "2", "2")
ov2 <- c("3", "3", "2", "2", "2", "3")
siml_idx(ov1, ov2, "jaccard", TRUE)
# binary vector
bin1 <- c(1, 1, 1, 1, 0, 0, 0)
bin2 <- c(1, 1, 0, 0, 1, 1, 0)
siml_idx(bin1, bin2, method="jaccard")
siml_idx(bin1, bin2, method="simpson")
siml_idx(bin1, bin2, method="smc")
siml_idx(bin1, bin2, method="dice")
# numeric vector
n1 <- c(4.47, 4.35, 4.94, 3.09)
n2 <- c(3.86, 5.95, 5.48, 5.18)
siml_idx(n1, n2, method="tanimoto")
siml_idx(n1, n2, method="cosine")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.