Learn R Programming

distances

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:

install.packages("distances")

Copy Link

Version

Install

install.packages('distances')

Monthly Downloads

5,871

Version

0.1.13

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Fredrik Savje

Last Published

November 24th, 2025

Functions in distances (0.1.13)

distance_matrix

Distance matrix
max_distance_search

Max distance search
distance_columns

Distance matrix columns
nearest_neighbor_search

Nearest neighbor search
is.distances

Check distances object
distances-package

distances: Tools for Distance Metrics
distances

Constructor for distance metric objects