Calculate Pairwise Distances

A common framework for calculating distance matrices.


An R package to calculate distances. This provide a common framework to calculate distances.
There are three main functions:

  • rdist computes the pairwise distances between observations in one matrix and returns a dist object,
  • pdist computes the pairwise distances between observations in one matrix and returns a matrix, and
  • cdist computes the distances between observations in two matrices and returns a matrix.

All functions have an argument metric that can be used to specify the distance function. Available metrics are "euclidean", "minkowski", "manhattan", "maximum", "canberra", "angular", "correlation", "absolute_correlation", "hamming", and "jaccard". In addition the metric can be any function that takes two vectors as arguments and returns their distance. All predefined functions will return NA or NaN when one of the compared vectors contains NAs.

Installation

To install the latest released version from CRAN:

install.packages("rdist")

To install the latest development version from github:

install.packages("devtools")
devtools::install_github("blasern/rdist")

Development

If you find issues, please let me know. If you would like to contribute, please create a pull request.

News

rdist 0.0.3

  • Added documentation pages
  • Added product_metric
  • Added farthest_point_sampling
  • Added is_distance_matrix and triangle_inequality checks

rdist 0.0.2

  • Fixed bug in jaccard distance
  • Fixed bug in euclidean distance
  • Added labels to rdist output

rdist 0.0.1

An R package to calculate distances. This provide a common framework to calculate distances.
There are three main functions:

  • rdist computes the pairwise distances between observations in one matrix and returns a dist object,
  • pdist computes the pairwise distances between observations in one matrix and returns a matrix, and
  • cdist computes the distances between observations in two matrices and returns a matrix.

All functions have an argument metric that can be used to specify the distance function. Available metrics are "euclidean", "minkowski", "manhattan", "maximum", "canberra", "angular", "correlation", "absolute_correlation", "hamming", and "jaccard". All functions will return NA or NaN when one of the compared vectors contains NAs.

Installation

To install the latest released version from CRAN:

install.packages("rdist")

To install the latest development version from github:

install.packages("devtools")
devtools::install_github("blasern/rdist")

Development

If you find issues, please let me know. If you would like to contribute, please create a pull request.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rdist")

0.0.3 by Nello Blaser, 8 months ago


https://github.com/blasern/rdist


Report a bug at https://github.com/blasern/rdist/issues


Browse source code at https://github.com/cran/rdist


Authors: Nello Blaser [aut, cre]


Documentation:   PDF Manual  


GPL license


Imports Rcpp, methods

Suggests testthat

Linking to Rcpp, RcppArmadillo


Depended on by BRISC.


See at CRAN