distances v0.1.6


Monthly downloads



Tools for Distance Metrics

Provides tools for constructing, manipulating and using distance metrics.



CRAN Status Build Status Build status codecov

The distances package provides tools for constructing, manipulating and using distance metrics in R. It calculates distances only as needed (unlike the standard dist function which derives the complete distance matrix when called). This saves memory and can increase speed. The package also includes functions for fast nearest and farthest neighbor searching.

How to install

distances is on CRAN and can be installed by running:


How to install development version

It is recommended to use the stable CRAN version, but the latest development version can be installed directly from Github using devtools:

if (!require("devtools")) install.packages("devtools")

The package contains compiled code, and you must have a development environment to install the development version. (Use devtools::has_devel() to check whether you do.) If no development environment exists, Windows users download and install Rtools and macOS users download and install Xcode.

Functions in distances

Name Description
nearest_neighbor_search Nearest neighbor search
is.distances Check distances object
max_distance_search Max distance search
distance_columns Distance matrix columns
distance_matrix Distance matrix
distances-package distances: Tools for Distance Metrics
distances Constructor for distance metric objects
No Results!

Last month downloads


Type Package
Date 2018-12-12
NeedsCompilation yes
License GPL (>= 3)
LicenseNote The distances packages includes the ANN library (distributed under the LGPLv2.1 license).
URL https://github.com/fsavje/distances
BugReports https://github.com/fsavje/distances/issues
Encoding UTF-8
RoxygenNote 6.1.1
Packaged 2018-12-12 21:08:19 UTC; fredriksavje
Repository CRAN
Date/Publication 2018-12-12 23:00:03 UTC
depends R (>= 3.4.0)
imports stats
suggests testthat

Include our badge in your README