Learn R Programming

bingat (version 1.3)

calcDistance: Calculate the Distance Between Vectors

Description

This function calculates the distance between two vectors.

Usage

calcDistance(x, y, type = "", method = "hamming")

Arguments

x, y

Vectors of the same length that contain 1's and 0's.

type

The type of graph being used (adjmatrix or adjmatrixlt). See 'Details'

method

The distance metric to use, currently only "hamming" is supported.

Value

A single number indicating the distance between the two input vectors.

Details

If the type = "adjMatrix" is used, the value will be divided by 2 to account for duplicate comparisons. Otherwise the type does not affect the output.

Examples

Run this code
	data(braingraphs)
	
	dist <- calcDistance(braingraphs[,1], braingraphs[,2], "adjMatrix")
	dist

Run the code above in your browser using DataLab