dist_cosine: Compute Cosine Distances

Description Usage Arguments Details Value Examples

View source: R/svs.r

Description

A function for computing cosine distances.

Usage

1
2
3
dist_cosine(x, diag = FALSE, upper = FALSE)

dist_cos(x, diag = FALSE, upper = FALSE)

Arguments

x

A numeric matrix (containing coordinates).

diag

Logical specifying whether the diagonal of the resulting distance matrix should be printed.

upper

Logical specifying whether the upper triangle of the resulting distance matrix should be printed.

Details

The cosine distance equals 1 - the cosine similarity.

Value

A distance matrix.

Examples

1
2
3
4
5
SndT_Fra <- read.table(system.file("extdata", "SndT_Fra.txt", package = "svs"),
   header = TRUE, sep = "\t", quote = "\"", encoding = "UTF-8",
   stringsAsFactors = FALSE)
lsa.SndT_Fra <- fast_lsa(SndT_Fra)
dist_cosine(lsa.SndT_Fra$pos1[, 1:7])

svs documentation built on Nov. 10, 2020, 1:09 a.m.