Learn R Programming

shipunov (version 1.11)

SM.dist: Simple Match distance

Description

Calculates simple match distance

Usage

SM.dist(data)

Arguments

data

Matrix (or data frame) with variables that should be used in the computation of the distance between rows.

Value

Distance object with distances among rows of 'data'

Details

If argument is the data frame, SM.dist() internally converts it into the matrix. If there are character values, they will be converted column-wise to factors and then to integers.

See Also

dist

Examples

Run this code
# NOT RUN {
ii <- cluster::pam(SM.dist(sapply(iris[, -5], round)), k=3)
Misclass(ii$clustering, iris$Species, best=TRUE)

i2 <- cluster::pam(SM.dist(iris), k=3) # SM.dist() "consumes" all types of data
Misclass(i2$clustering, iris$Species, best=TRUE)

# }

Run the code above in your browser using DataLab