Learn R Programming

sarp.snowprofile.alignment (version 1.0.2)

sim2dist: Convert 'similarity' matrix to 'distance' matrix

Description

Convert a 'similarity' matrix to 'distance' matrix. Note that the similarity must be normalized (i.e. within [0, 1])

Usage

sim2dist(SimMat)

Arguments

SimMat

similarity matrix of type data.frame with ranges [0, 1]

Value

copy of input data.frame with similarities inverted to distances (i.e. dist = 1 - sim)

Examples

Run this code
# NOT RUN {
## the 'swissSimilarityMatrix' as similarity and as distance
graphics::image(as.matrix(swissSimilarityMatrix))
graphics::image(as.matrix(sim2dist(swissSimilarityMatrix)))

# }

Run the code above in your browser using DataLab