Learn R Programming

colordistance (version 1.1.2)

chisqDistance: Chi-square distance between vectors

Description

Computes the chi-squared distance between each element of a pair of vectors which must be of the same length. Good for comparing color histograms if you don't want to weight by color similarity. Probably hugely redundant; alas.

Usage

chisqDistance(a, b)

Arguments

a

Numeric vector.

b

Numeric vector; must be the same length as a.

Value

Chi-squared distance, \((a - b)^2/(a + b)\), between vectors a and b. If one or both elements are NA/NaN, contribution is counted as a 0.

Examples

Run this code
# NOT RUN {
colordistance:::chisqDistance(rnorm(10), rnorm(10))
# }

Run the code above in your browser using DataLab