cosineDist: Compute the cosine distance of two vectors

Description Usage Arguments Value Examples

View source: R/basic_functions.R

Description

Compute the cosine distance of two vectors

Usage

1
cosineDist(a, b)

Arguments

a, b

Numerical vectors of same length

Value

The scalar product of the two input vectors divided by the product of the norms of the two input vectors

Examples

1
2
3
4
5
6
## 1. Orthogonal vectors:
cosineDist(c(1,0),c(0,1))
## 2. Non-orthogonal vectors:
cosineDist(c(1,0),c(1,1))
## Compare trigonometry:
1-cos(pi/4)

huebschm/YAPSA documentation built on May 17, 2019, 9:11 p.m.