textDistMatrix: Calculate a Text Distance Matrix

View source: R/distance.R

textDistMatrixR Documentation

Calculate a Text Distance Matrix

Description

Calculate a distance matrix for a numeric matrix, using the textDist function. It is used to calculate the text distance between all combinations of the columns of the matrix M.

Usage

textDistMatrix(M, zeroes = 0.5)

Arguments

M

A numeric matrix

zeroes

Text distance when both vectors are zero vectors; default is .5

Value

The text distance matrix with the text distance between all combinations of the columns of M. This will give the same result as the function distMatrix when run with its default distance function "textDist"; however, for large matrices textDistMatrix is much more efficient. In addition, for very large matrices distMatrix may not run, while textDistMatrix will.

Examples

M=matrix(c(0,1,0,2,0,10,0,14,12,0,8,0,1,0,1,0),4)
colnames(M)=1:4;rownames(M)=c("A","B","C","D")
M
#Text distance matrix
textDistMatrix(M)

phm documentation built on June 8, 2022, 1:05 a.m.